JPA Interface

From<Z,X>

Type Parameters:
<Z> - the source type
<X> - the target type

Represents a bound type, usually an entity that appears in the from clause, but may also be an embeddable belonging to an entity in the from clause.

Serves as a factory for Joins of associations, embeddables, and collections belonging to the type, and for Paths of attributes belonging to the type.

Since:
JPA 2.0

Public Methods

Fetch<X,Y> fetch(PluralAttribute<?superX,?,Y> attribute)
Create a fetch join to the specified collection-valued attribute using an inner join.
Parameters:
attribute - target of the join
Return:
the resulting join
Inherited from:
FetchParent<Z,X>
Since:
JPA 2.0
Fetch<X,Y> fetch(PluralAttribute<?superX,?,Y> attribute, JoinType jt)
Create a fetch join to the specified collection-valued attribute using the given join type.
Parameters:
attribute - target of the join
jt - join type
Return:
the resulting join
Inherited from:
FetchParent<Z,X>
Since:
JPA 2.0
Fetch<X,Y> fetch(SingularAttribute<?superX,Y> attribute)
Create a fetch join to the specified single-valued attribute using an inner join.
Parameters:
attribute - target of the join
Return:
the resulting fetch join
Inherited from:
FetchParent<Z,X>
Since:
JPA 2.0
Fetch<X,Y> fetch(SingularAttribute<?superX,Y> attribute, JoinType jt)
Create a fetch join to the specified single-valued attribute using the given join type.
Parameters:
attribute - target of the join
jt - join type
Return:
the resulting fetch join
Inherited from:
FetchParent<Z,X>
Since:
JPA 2.0
Fetch<X,Y> fetch(String attributeName)
Create a fetch join to the specified attribute using an inner join.
Parameters:
attributeName - name of the attribute for the target of the join
Return:
the resulting fetch join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Inherited from:
FetchParent<Z,X>
Since:
JPA 2.0
Fetch<X,Y> fetch(String attributeName, JoinType jt)
Create a fetch join to the specified attribute using the given join type.
Parameters:
attributeName - name of the attribute for the target of the join
jt - join type
Return:
the resulting fetch join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Inherited from:
FetchParent<Z,X>
Since:
JPA 2.0
Expression<M> get(MapAttribute<X,K,V> map)
Create a path corresponding to the referenced map-valued attribute.
Parameters:
map - map-valued attribute
Return:
expression corresponding to the referenced attribute
Inherited from:
Path<X>
Since:
JPA 2.0
Expression<C> get(PluralAttribute<X,C,E> collection)
Create a path corresponding to the referenced collection-valued attribute.
Parameters:
collection - collection-valued attribute
Return:
expression corresponding to the referenced attribute
Inherited from:
Path<X>
Since:
JPA 2.0
Path<Y> get(SingularAttribute<?superX,Y> attribute)
Create a path corresponding to the referenced single-valued attribute.
Parameters:
attribute - single-valued attribute
Return:
path corresponding to the referenced attribute
Inherited from:
Path<X>
Since:
JPA 2.0
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 - name of the attribute
Return:
path corresponding to the referenced attribute
Throws:
IllegalStateException - if invoked on a path that corresponds to a basic type
IllegalArgumentException - if attribute of the given name does not otherwise exist
Inherited from:
Path<X>
Since:
JPA 2.0
Returns the parent From object from which the correlated From object has been obtained through correlation (use of a Subquery correlate method).
Return:
the parent of the correlated From object
Throws:
IllegalStateException - if the From object has not been obtained through correlation
Since:
JPA 2.0
Set<Fetch<X,?>> getFetches()
Return the fetch joins that have been made from this type.
Returns empty set if no fetch joins have been made from this type. Modifications to the set do not affect the query.
Return:
fetch joins made from this type
Inherited from:
FetchParent<Z,X>
Since:
JPA 2.0
Set<Join<X,?>> getJoins()
Return the joins that have been made from this bound type.
Returns empty set if no joins have been made from this bound type. Modifications to the set do not affect the query.
Return:
joins made from this type
Since:
JPA 2.0
Return the bindable object that corresponds to the path expression.
Return:
bindable object corresponding to the path
Inherited from:
Path<X>
Since:
JPA 2.0
Path<?> getParentPath()
Return the parent "node" in the path or null if no parent.
Return:
parent
Inherited from:
Path<X>
Since:
JPA 2.0
boolean isCorrelated()
Whether the From object has been obtained as a result of correlation (use of a Subquery correlate method).
Return:
boolean indicating whether the object has been obtained through correlation
Since:
JPA 2.0
CollectionJoin<X,Y> join(CollectionAttribute<?superX,Y> collection)
Create an inner join to the specified Collection-valued attribute.
Parameters:
collection - target of the join
Return:
the resulting join
Since:
JPA 2.0
CollectionJoin<X,Y> join(CollectionAttribute<?superX,Y> collection, JoinType jt)
Create a join to the specified Collection-valued attribute using the given join type.
Parameters:
collection - target of the join
jt - join type
Return:
the resulting join
Since:
JPA 2.0
ListJoin<X,Y> join(ListAttribute<?superX,Y> list)
Create an inner join to the specified List-valued attribute.
Parameters:
list - target of the join
Return:
the resulting join
Since:
JPA 2.0
ListJoin<X,Y> join(ListAttribute<?superX,Y> list, JoinType jt)
Create a join to the specified List-valued attribute using the given join type.
Parameters:
list - target of the join
jt - join type
Return:
the resulting join
Since:
JPA 2.0
MapJoin<X,K,V> join(MapAttribute<?superX,K,V> map)
Create an inner join to the specified Map-valued attribute.
Parameters:
map - target of the join
Return:
the resulting join
Since:
JPA 2.0
MapJoin<X,K,V> join(MapAttribute<?superX,K,V> map, JoinType jt)
Create a join to the specified Map-valued attribute using the given join type.
Parameters:
map - target of the join
jt - join type
Return:
the resulting join
Since:
JPA 2.0
SetJoin<X,Y> join(SetAttribute<?superX,Y> set)
Create an inner join to the specified Set-valued attribute.
Parameters:
set - target of the join
Return:
the resulting join
Since:
JPA 2.0
SetJoin<X,Y> join(SetAttribute<?superX,Y> set, JoinType jt)
Create a join to the specified Set-valued attribute using the given join type.
Parameters:
set - target of the join
jt - join type
Return:
the resulting join
Since:
JPA 2.0
Join<X,Y> join(SingularAttribute<?superX,Y> attribute)
Create an inner join to the specified single-valued attribute.
Parameters:
attribute - target of the join
Return:
the resulting join
Since:
JPA 2.0
Join<X,Y> join(SingularAttribute<?superX,Y> attribute, JoinType jt)
Create a join to the specified single-valued attribute using the given join type.
Parameters:
attribute - target of the join
jt - join type
Return:
the resulting join
Since:
JPA 2.0
Join<X,Y> join(String attributeName)
Create an inner join to the specified attribute.
Parameters:
attributeName - name of the attribute for the target of the join
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
Join<X,Y> join(String attributeName, JoinType jt)
Create a join to the specified attribute using the given join type.
Parameters:
attributeName - name of the attribute for the target of the join
jt - join type
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
CollectionJoin<X,Y> joinCollection(String attributeName)
Create an inner join to the specified Collection-valued attribute.
Parameters:
attributeName - name of the attribute for the target of the join
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
CollectionJoin<X,Y> joinCollection(String attributeName, JoinType jt)
Create a join to the specified Collection-valued attribute using the given join type.
Parameters:
attributeName - name of the attribute for the target of the join
jt - join type
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
ListJoin<X,Y> joinList(String attributeName)
Create an inner join to the specified List-valued attribute.
Parameters:
attributeName - name of the attribute for the target of the join
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
ListJoin<X,Y> joinList(String attributeName, JoinType jt)
Create a join to the specified List-valued attribute using the given join type.
Parameters:
attributeName - name of the attribute for the target of the join
jt - join type
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
MapJoin<X,K,V> joinMap(String attributeName)
Create an inner join to the specified Map-valued attribute.
Parameters:
attributeName - name of the attribute for the target of the join
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
MapJoin<X,K,V> joinMap(String attributeName, JoinType jt)
Create a join to the specified Map-valued attribute using the given join type.
Parameters:
attributeName - name of the attribute for the target of the join
jt - join type
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
SetJoin<X,Y> joinSet(String attributeName)
Create an inner join to the specified Set-valued attribute.
Parameters:
attributeName - name of the attribute for the target of the join
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
SetJoin<X,Y> joinSet(String attributeName, JoinType jt)
Create a join to the specified Set-valued attribute using the given join type.
Parameters:
attributeName - name of the attribute for the target of the join
jt - join type
Return:
the resulting join
Throws:
IllegalArgumentException - if attribute of the given name does not exist
Since:
JPA 2.0
Expression<Class<?extendsX>> type()
Create an expression corresponding to the type of the path.
Return:
expression corresponding to the type of the path
Inherited from:
Path<X>
Since:
JPA 2.0