Criterion « Query « JPA Q&A





1. How to make a criteria query with 3 OR Criterions properly?    stackoverflow.com

I'd like to make a criteria query with 3 OR Criterions and I dont know what is the best way to do it. Currently I only have 2 or Restrictions.

Criteria crit = ...

2. Criterion Restrictions.like and numbers and dates    stackoverflow.com

I'm using Hibernate over mySQL. In mySQL you can put LIKE in queries even on number (like double) parameters and dates, for example you can write:

select * from sillytable where field ...

3. Create Hibernate criterion to select on property of property    stackoverflow.com

I have two classes:

class A {
    private B b;
    /* ... */
}

class B {
    private String c;
    /* ... ...

4. Using Criterion API to build the queries in hibernate?    stackoverflow.com

The main advantage of using Criterion API to build the queries dynamically at run time. But whatever examples i have seen for criterion api on different sites , it involves ...

5. Hibernate Criterion query: org.hibernate.exception.SQLGrammarException: could not execute query    coderanch.com

Hi All, I have been trying to implement a sql query in hibernate using the criteria API desperately. I have been getting this exception all along can someone please point what I am missing? Here is the criteria query Criteria crit = session().createCriteria(P.class) .add(Restrictions.eq("id", new Integer(400))) .createAlias("N", "n", CriteriaSpecification.LEFT_JOIN) .add(Restrictions.eq("n.asses", "ref")) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return crit.list(); Below is the exception that I get ...

6. Use property in Projections and in a Criterion gives error    forum.hibernate.org

I am doing something like the next: .... Criterion criterio2 = Restrictions.ilike("artiNombre", query, MatchMode.START); ProjectionList proList = Projections.projectionList(); proList.add(Projections.property("artiNombre"),"artiNombre"); criterio.setProjection(proList); criterio.setResultTransformer(Transformers.aliasToBean(Sene1Articulo.class)); ...... It generates: select this_.ARTI_NOMBRE as y2_ from sene1_articulos this_ where and lower(y2_) like ? And Oracle says: ORA-00904: "Y2_": identifier not valid. I think its because Im using an alias in the ProjectionList for "artiNombre" and Iam using a ...

7. How to run not in query using Hibernate criterion?    forum.hibernate.org

Hi We have two tables in our application called Groups and Tags. There is many to many relationship between Groups and Tags. For this we have another table GroupTag which has groupId and TagId. -- Table 1 -- Groups Id int GroupName varchar -- Table 2 -- Tags Id int TagName varchar -- Table 3 -- GroupTag id int groupId int ...

9. Criterion with in clause    forum.hibernate.org

I am attempting to create an in clause via the Criterion api - I am trying to replicate the functionality possible with the following HQL: select a from A as a where :param in a.collectionProperty1OfA.propetyOnCollectionObj or :param in a.collectionProperty2OfA.propetyOnCollectionObj When translating that to Criteria, it seems that everything is possible except for the "in". The Restrictions exposed in - but as ...





11. Criterion instances involving subqueries!    forum.hibernate.org

Hello! I have looked every where for a way to solve my problemt, but the only examples are like DetachedCriteria weights = DetachedCriteria.forClass(Cat.class) .setProjection( Property.forName("weight") ); session.createCriteria(Cat.class) .add( Subqueries.geAll("weight", weights) ) .list(); But what i want it's the equivalent of the following sql example: SELECT * ..FROM Cat c LEFT OUTER JOIN ....( SELECT pedigreeId, catId ........FROM pedigree ........WHERE category = ...

13. Possible bug with Criterion queries?!    forum.hibernate.org

Author Message steppinrazor Post subject: Possible bug with Criterion queries?! Posted: Fri Apr 18, 2008 7:15 pm Beginner Joined: Thu Feb 28, 2008 11:53 am Posts: 23 Hibernate version: 3.2 Mapping documents: Using XML Name and version of the database I am using: Oracle XE/10G Code: 2008-04-10 19:11:20,369 INFO [net.tp.util.CriterionFactoryForFilterTypes] - ...