Top Description Methods
javax.persistence.criteria

public Interface Path<X>

extends Expression<X>
Known Direct Subinterfaces
javax.persistence.criteria.From
Type Parameters
<X>
the type referenced by the path
Imports
javax.persistence.metamodel.PluralAttribute, .SingularAttribute, .Bindable, .MapAttribute

Represents a simple or compound attribute path from a bound type or collection, and is a "primitive" expression.
Since
Java Persistence 2.0

Method Summary

Modifier and TypeMethod and Description
public <Y> Path<Y>

Returns:

path corresponding to the referenced attribute
get
(SingularAttribute<? super X, Y>
single-valued attribute
attribute
)

Create a path corresponding to the referenced single-valued attribute.

public <E, C extends Collection<E>> Expression<C>

Returns:

expression corresponding to the referenced attribute
get
(PluralAttribute<X, C, E>
collection-valued attribute
collection
)

Create a path corresponding to the referenced collection-valued attribute.

public <K, V, M extends Map<K, V>> Expression<M>

Returns:

expression corresponding to the referenced attribute
get
(MapAttribute<X, K, V>
map-valued attribute
map
)

Create a path corresponding to the referenced map-valued attribute.

public <Y> Path<Y>

Returns:

path corresponding to the referenced attribute
get
(String
name of the attribute
attributeName
)

Create a path corresponding to the referenced attribute.

public Bindable<X>

Returns:

bindable object corresponding to the path
getModel
()

Return the bindable object that corresponds to the path expression.

public Path<?>

Returns:

parent
getParentPath
()

Return the parent "node" in the path or null if no parent.

public Expression<Class<? extends X>>

Returns:

expression corresponding to the type of the path
type
()

Create an expression corresponding to the type of the path.

Inherited from javax.persistence.criteria.Expression:
asininininisNotNullisNull

Method Detail

getback to summary
public <Y> Path<Y> get(SingularAttribute<? super X, Y> attribute)

Create a path corresponding to the referenced single-valued attribute.

Parameters
attribute:SingularAttribute<? super X, Y>

single-valued attribute

Returns:Path<Y>

path corresponding to the referenced attribute

getback to summary
public <E, C extends Collection<E>> Expression<C> get(PluralAttribute<X, C, E> collection)

Create a path corresponding to the referenced collection-valued attribute.

Parameters
collection:PluralAttribute<X, C, E>

collection-valued attribute

Returns:Expression<C>

expression corresponding to the referenced attribute

getback to summary
public <K, V, M extends Map<K, V>> Expression<M> get(MapAttribute<X, K, V> map)

Create a path corresponding to the referenced map-valued attribute.

Parameters
map:MapAttribute<X, K, V>

map-valued attribute

Returns:Expression<M>

expression corresponding to the referenced attribute

getback to summary
public <Y> Path<Y> get(String attributeName)

Create a path corresponding to the referenced attribute.

Note

Applications using the string-based API may need to specify the type resulting from the get operation in order to avoid the use of Path variables.

   For example:

   CriteriaQuery<Person> q = cb.createQuery(Person.class);
   Root<Person> p = q.from(Person.class);
   q.select(p)
    .where(cb.isMember("joe",
                       p.<Set<String>>get("nicknames")));

   rather than:

   CriteriaQuery<Person> q = cb.createQuery(Person.class);
   Root<Person> p = q.from(Person.class);
   Path<Set<String>> nicknames = p.get("nicknames");
   q.select(p)
    .where(cb.isMember("joe", nicknames));
Parameters
attributeName:String

name of the attribute

Returns:Path<Y>

path corresponding to the referenced attribute

Exceptions
IllegalStateException:
if invoked on a path that corresponds to a basic type
IllegalArgumentException:
if attribute of the given name does not otherwise exist
getModelback to summary
public Bindable<X> getModel()

Return the bindable object that corresponds to the path expression.

Returns:Bindable<X>

bindable object corresponding to the path

getParentPathback to summary
public Path<?> getParentPath()

Return the parent "node" in the path or null if no parent.

Returns:Path<?>

parent

typeback to summary
public Expression<Class<? extends X>> type()

Create an expression corresponding to the type of the path.

Returns:Expression<Class<? extends X>>

expression corresponding to the type of the path