1. Controlling Hibernate's generated subselect stackoverflow.comConsider the following three Hibernate entities:
|
2. Criteria with subselect stackoverflow.comI need create a query in Java using Hibernate Criteria. I create a similar query in MySql, but I don't know how to do this in Hibernate. Follow below the sample:
|
3. Problems with subselect and DetachedCriteria forum.hibernate.orgI sure am glad you made that post, you saved me some time =) I ran into the same NPE doing the same thing you were doing, and was just about ready to go to the code base myself. Adding a projection was just the ticket. It's been so long that I'm sure you've got a solution to your second problem ... |
4. criteria with subselect forum.hibernate.orggetting closer i think but: Criteria criteria = session.createCriteria(ClassName.class); DetachedCriteria dc = DetachedCriteria.forClass(ClassName.class) .add(Restrictions.gt("id", new Integer(id))) .setProjection(Projections.min("id")); criteria.add(Subqueries.eq("id",dc)); still not working. sql comes out to : select this_.TITLE_ID as TITLE1_0_0_, this_.TITLE as TITLE0_0_, this_.DATE_STRING as DATE3_0_0_ , this_.LIST_DATE as LIST4_0_0_ from top_ten_title this_ where ? = (select min(this0__.TITLE_ID) as y0_ from top_ten_title this0__ where this0__.TITLE_ID>?) i'm curious about the line with ... |
5. Criteria, subselect forum.hibernate.orgHello. I really hope, that you can help me. I have entity class, called property and it has OneToMany relation with Image: Code: private Set |