java Programming Glossary: cq
How to query an M:N relationship with JPA2? http://stackoverflow.com/questions/11297241/how-to-query-an-mn-relationship-with-jpa2 cb em.getCriteriaBuilder CriteriaQuery BlogPost cq cb.createQuery BlogPost.class Root BlogPost blogPost cq.from.. cq cb.createQuery BlogPost.class Root BlogPost blogPost cq.from BlogPost.class SetJoin BlogPost Tag tags blogPost.join.. Predicate predicate tags.get Tag_.id .in myTagsIds cq.distinct true cq.where predicate TypedQuery BlogPost tq em.createQuery..
JPA & Criteria API - Select only specific columns http://stackoverflow.com/questions/12618489/jpa-criteria-api-select-only-specific-columns need to write something like this CriteriaQuery Tuple cq builder.createTupleQuery write the Root Path elements as usual.. the Root Path elements as usual Root EntityClazz root cq.from EntityClazz.class cq.multiselect root.get EntityClazz_.ID.. as usual Root EntityClazz root cq.from EntityClazz.class cq.multiselect root.get EntityClazz_.ID root.get EntityClazz_.VERSION..
Dynamic JPA 2.0 query using Criteria API http://stackoverflow.com/questions/2510106/dynamic-jpa-2-0-query-using-criteria-api CriteriaBuilder cb em.getCriteriaBuilder CriteriaQuery Foo cq cb.createQuery Foo.class Metamodel m em.getMetamodel EntityType.. EntityType Foo Foo_ m.entity Foo.class Root Foo foo cq.from Foo_ cq.where my.get Foo_.name .in params You might want.. Foo Foo_ m.entity Foo.class Root Foo foo cq.from Foo_ cq.where my.get Foo_.name .in params You might want to check Basic..
Brainstorming: Weird JPA problem, possibly classpath or jar versioning problem? http://stackoverflow.com/questions/2614989/brainstorming-weird-jpa-problem-possibly-classpath-or-jar-versioning-problem I had this code that produced the same error CriteriaQuery cq entityManager.getCriteriaBuilder .createQuery cq.select cq.from.. cq entityManager.getCriteriaBuilder .createQuery cq.select cq.from com.xyz.abc.services.persistence.entity.MyEntity.class.. cq entityManager.getCriteriaBuilder .createQuery cq.select cq.from com.xyz.abc.services.persistence.entity.MyEntity.class..
Hibernate Criteria API - adding a criterion: string should be in collection http://stackoverflow.com/questions/2735071/hibernate-criteria-api-adding-a-criterion-string-should-be-in-collection b em.getCriteriaBuilder CriteriaQuery Foobar cq b.createQuery Foobar.class Root Foobar foobar cq.from Foobar.class.. Foobar cq b.createQuery Foobar.class Root Foobar foobar cq.from Foobar.class TypedQuery Foobar q em.createQuery cq.select.. cq.from Foobar.class TypedQuery Foobar q em.createQuery cq.select foobar .where b.isMember abc123 foobar. List String..
In JPA 2, using a CriteriaQuery, how to count results http://stackoverflow.com/questions/2883887/in-jpa-2-using-a-criteriaquery-how-to-count-results cb entityManager.getCriteriaBuilder CriteriaQuery MyEntity cq cb .createQuery MyEntityclass initialize predicates here return.. predicates here return entityManager.createQuery cq .getResultList .size And that can't be the proper way to do.. qb entityManager.getCriteriaBuilder CriteriaQuery Long cq qb.createQuery Long.class cq.select qb.count cq.from MyEntity.class..
Complex queries with JPA criteria builder http://stackoverflow.com/questions/3842122/complex-queries-with-jpa-criteria-builder cb em.getCriteriaBuilder CriteriaQuery Tuple cq cb.createTupleQuery Root Transaction r cq.from Transaction.class.. Tuple cq cb.createTupleQuery Root Transaction r cq.from Transaction.class Predicate p cb.conjunction for Map.Entry.. p cb.and p cb.equal r.get param.getKey param.getValue cq.multiselect r.get id r.get status r.get created_at .where p..
|