Internal Website Search

1-50 of 84 results

SELECT clause (JPQL / Criteria API)

FROM Country c can be built as a criteria query as follows: CriteriaQuery q = cb. createQuery (Country ... .capital.name FROM Country c can be defined using the criteria API as follows: CriteriaQuery q = cb ... ]); } CriteriaBuilder's tuple The Tuple interface can be used as a clean alternative to Object[] : CriteriaQuery q

FROM clause (JPQL / Criteria API)

interface (and its sub interfaces). Criteria Query Roots The CriteriaQuery 's from method serves as ... query using the following code: CriteriaQuery q = cb. createQuery (Country.class); Root c1 = q. from ... other CriteriaQuery  methods - invocation of the from method does not override a previous invocation

JPA Criteria API Queries

: CriteriaBuilder cb = em. getCriteriaBuilder (); CriteriaQuery q = cb. createQuery (Country.class ... (both methods are equivalent). In the example above a  CriteriaQuery instance is created ... expression. A  CriteriaQuery instance is equivalent to a JPQL string and not to a TypedQuery instance

javax.persistence.criteria.CriteriaQuery

JPA Interface CriteriaQuery Type Parameters: - the type of the defined result Super Interfaces: AbstractQuery , CommonAbstractCriteria The CriteriaQuery interface defines functionality ... CriteriaQuery . Public Methods CriteriaQuery distinct (boolean distinct) Specify

CriteriaQuery .where() for multiple conditions

When using the below, there appears to be an OR condition:   criteriaQuery .where(criteriaBuilder.equal(root.get("name"), name)); criteriaQuery .where(criteriaBuilder.equal(root.get("surname ... (); CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Person.class); Root root = criteriaQuery

CriteriaQuery.multiselect(selectionList) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery multiselect (    ... : If the type of the criteria query is CriteriaQuery (i.e., a criteria query object created by ... of the criteria query is CriteriaQuery for some user-defined class X (i.e., a criteria query object

CriteriaQuery.multiselect(selections) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery multiselect (    ... of the criteria query is CriteriaQuery (i.e., a criteria query object created by either the createTupleQuery ... is CriteriaQuery for some user-defined class X (i.e., a criteria query object created by passing a X class

"Unexpected query expression" using CriteriaQuery FetchParent Interface

; CriteriaQuery criteriaQuery = cb.createQuery(Person.class);   Root root = criteriaQuery .from(Person.class);   root.fetch("PersonData"); //@OneToOne relationship   criteriaQuery .select(root);   System.out.println(em.createQuery( criteriaQuery ).getResultList()); } }   Exception in

CriteriaQuery.select(selection) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery select (    ... type is specified. For example: CriteriaQuery q = cb.createQuery(String.class); Root order = q.from(Order.class); q.select(order.get("shippingAddress"). get("state")); CriteriaQuery q2 = cb.createQuery

EntityManager.createQuery(criteriaQuery) - JPA Method

JPA Method in javax.persistence.EntityManager TypedQuery createQuery (    CriteriaQuery   criteriaQuery ) Create an instance of TypedQuery for executing a criteria query. Parameters: criteriaQuery - a criteria query object Return: the new query instance Throws

JPA CriteriaQuery -- Iterate Expression>

Hi, I am new to  JPA and in particular the CriteriaQuery API. I have a simple CriteriaQuery where I pattern match a simple search String against field entires in a Person entity... i.e ... record.FIELD LIKE searchString) Path status = root.get("status"); criteriaQuery .where( builder.or

CriteriaQuery.having(restriction) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery having (    Expression  restriction ) Specify a restriction over the groups of the query. Replaces the previous having restriction(s), if any. This method only overrides the return type of the corresponding

CriteriaQuery.groupBy(grouping) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery groupBy (    Expression ... grouping ) Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions

CriteriaQuery.groupBy(grouping) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery groupBy (   List  grouping ) Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any

CriteriaQuery.where(restrictions) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery where (   Predicate... restrictions ) Modify the query to restrict the query result according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any

CriteriaQuery.distinct(distinct) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery distinct (   boolean distinct ) Specify whether duplicate query results will be eliminated. A true value will cause duplicates to be eliminated. A false value will cause duplicates to be retained. If distinct

CriteriaQuery.orderBy(o) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery orderBy (   List  o ) Specify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering

CriteriaQuery.having(restrictions) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery having (   Predicate... restrictions ) Specify restrictions over the groups of the query according the conjunction of the specified restriction predicates. Replaces the previously added having restriction(s

CriteriaQuery.orderBy(o) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery orderBy (   Order... o ) Specify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous

CriteriaQuery.where(restriction) - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery CriteriaQuery where (    Expression  restriction ) Modify the query to restrict the query result according to the specified boolean expression. Replaces the previously added restriction(s), if any. This method only overrides

CriteriaQuery.getOrderList() - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery List getOrderList () Return the ordering expressions in order of precedence. Returns empty list if no ordering expressions have been specified. Modifications to the list do not affect the query. Return: the list of ordering expressions Since: JPA 2.0

CriteriaQuery.getParameters() - JPA Method

JPA Method in javax.persistence.criteria. CriteriaQuery Set getParameters () Return the parameters of the query. Returns empty set if there are no parameters. Modifications to the set do not affect the query. Return: the query parameters Since: JPA 2.0

CriteriaQuery using isNotNull with other conditions results in InternalException

When I try to execute the following criteria query CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery criteria = builder.createQuery(relationshipClass); Root root = criteria.from(relationshipClass); criteria.select(root); List predicates = new ArrayList (); predicates.add(builder

JPA Queries

; CriteriaQuery interface: As noted above, eventually every criteria query is managed by an ordinary TypedQuery instance. The CriteriaQuery instance merely represents the query during its building

WHERE clause (JPQL / Criteria API)

but they are especially dominant in the WHERE clause. WHERE in Criteria Queries The CriteriaQuery interface provides ... can be built by using the criteria query API as follows: CriteriaQuery q = cb. createQuery (Country.class

GROUP BY and HAVING clauses

and HAVING in Criteria Queries The CriteriaQuery interface provides methods for setting the GROUP BY ... using the criteria query API as follows: CriteriaQuery q = cb. createQuery (Country.class); Root c = q

ORDER BY clause (JPQL / Criteria API)

Criteria Queries The CriteriaQuery interface provides methods for setting the ORDER BY clause ... can be built using the criteria query API as follows: CriteriaQuery q = cb. createQuery (Country.class

ObjectDB CRUD Examples

(); CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Foo.class); Root root = criteriaQuery .from(Foo.class); List allFoo = (List ) criteriaQuery .select(root); em.getTransaction().commit(); em.close ... = em.getCriteriaBuilder(); CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(Foo.class); Root

javax.persistence.criteria.CriteriaBuilder

CriteriaQuery createQuery () Create a CriteriaQuery object. Return: criteria query object Since: JPA 2.0 CriteriaQuery createQuery (Class  resultClass) Create a CriteriaQuery object ... Since: JPA 2.0 CriteriaQuery createTupleQuery () Create a CriteriaQuery object that returns a tuple

javax.persistence.EntityManager

. See Also: Query TypedQuery CriteriaQuery PersistenceContext StoredProcedureQuery Since: JPA 1.0 The Database ... - if the delete query is found to be invalid Since: JPA 2.1 TypedQuery createQuery ( CriteriaQuery   criteriaQuery ) Create an instance of TypedQuery for executing a criteria query. Parameters

Object as parameter results in exception

= getEntityManager().getCriteriaBuilder();   CriteriaQuery c = qb.createQuery(managedClass);   Root ... qb = getEntityManager().getCriteriaBuilder();   CriteriaQuery c = qb.createQuery(managedClass ... efficiency please consider: Building the query (the CriteriaQuery and the TypedQuery

javax.persistence.criteria.Subquery

getContainingQuery () Return the query of which this is a subquery. This may be a CriteriaQuery ... of which this is a subquery. This must be a CriteriaQuery or a Subquery. Return: the enclosing query or subquery ... getRoots () Return the query roots. These are the roots that have been defined for the CriteriaQuery or

Path.get(attributeName) - JPA Method

variables. For example: CriteriaQuery q = cb.createQuery(Person.class); Root p = q.from(Person.class); q.select(p) .where(cb.isMember("joe", p. get("nicknames"))); rather than: CriteriaQuery q = cb

javax.persistence.criteria.From

order to avoid the use of Path variables. For example: CriteriaQuery q = cb.createQuery(Person.class ... "))); rather than: CriteriaQuery q = cb.createQuery(Person.class); Root p = q.from(Person.class); Path nicknames

javax.persistence.criteria.Path

the get operation in order to avoid the use of Path variables. For example: CriteriaQuery q = cb ... . get("nicknames"))); rather than: CriteriaQuery q = cb.createQuery(Person.class); Root p = q.from(Person.class

CriteriaBuilder.createTupleQuery() - JPA Method

JPA Method in javax.persistence.criteria.CriteriaBuilder CriteriaQuery createTupleQuery () Create a CriteriaQuery object that returns a tuple of objects as its result. Return: criteria query object Since: JPA 2.0

CriteriaBuilder.createQuery(resultClass) - JPA Method

JPA Method in javax.persistence.criteria.CriteriaBuilder CriteriaQuery createQuery (   Class  resultClass ) Create a CriteriaQuery object with the specified result type. Parameters: resultClass - type of the query result Return: criteria query object Since: JPA 2.0

CriteriaBuilder.createQuery() - JPA Method

JPA Method in javax.persistence.criteria.CriteriaBuilder CriteriaQuery createQuery () Create a CriteriaQuery object. Return: criteria query object Since: JPA 2.0

EntityManagerFactory.getCriteriaBuilder() - JPA Method

JPA Method in javax.persistence.EntityManagerFactory CriteriaBuilder getCriteriaBuilder () Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects. Return: CriteriaBuilder instance Throws: IllegalStateException - if the entity manager factory has been closed Since: JPA 2.0

javax.persistence.EntityManagerFactory

for the creation of CriteriaQuery objects. Return: CriteriaBuilder instance Throws

Query.setLockMode(lockMode) - JPA Method

Persistence query language SELECT query or a CriteriaQuery query Since: JPA 2.0

Subquery.getContainingQuery() - JPA Method

JPA Method in javax.persistence.criteria.Subquery CommonAbstractCriteria getContainingQuery () Return the query of which this is a subquery. This may be a CriteriaQuery , CriteriaUpdate, CriteriaDelete, or a Subquery. Return: the enclosing query or subquery Since: JPA 2.1

Subquery.getParent() - JPA Method

JPA Method in javax.persistence.criteria.Subquery AbstractQuery getParent () Return the query of which this is a subquery. This must be a CriteriaQuery or a Subquery. Return: the enclosing query or subquery Since: JPA 2.0

javax.persistence.Query

Persistence query language SELECT query or a CriteriaQuery query Since: JPA 2.0 Query setMaxResults (int

javax.persistence.TypedQuery

language SELECT query or a CriteriaQuery query Since: JPA 2.0 TypedQuery setMaxResults (int 

AbstractQuery.getRoots() - JPA Method

JPA Method in javax.persistence.criteria.AbstractQuery Set getRoots () Return the query roots. These are the roots that have been defined for the CriteriaQuery or Subquery itself, including any subquery roots defined as a result of correlation. Returns empty set if no roots have been defined

javax.persistence.StoredProcedureQuery

to be a Java Persistence query language SELECT query or a CriteriaQuery query Inherited from: Query

javax.persistence.criteria.AbstractQuery

for the CriteriaQuery or Subquery itself, including any subquery roots defined as a result of correlation

TypedQuery.setLockMode(lockMode) - JPA Method

to be a Java Persistence query language SELECT query or a CriteriaQuery query Since: JPA 2.0

EntityManager.getCriteriaBuilder() - JPA Method

JPA Method in javax.persistence.EntityManager CriteriaBuilder getCriteriaBuilder () Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects. Return: CriteriaBuilder instance Throws: IllegalStateException - if the entity manager has been closed Since: JPA 2.0