File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Problem with Hibernate Criteria, Projections and associations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem with Hibernate Criteria, Projections and associations" Watch "Problem with Hibernate Criteria, Projections and associations" New topic
Author

Problem with Hibernate Criteria, Projections and associations

Peter Wagner
Greenhorn

Joined: Oct 29, 2009
Posts: 3
Hi,

i have the following HQL and want to create an equivalent Criteria:



Person2.java:


The generated SQL loooks like this and works as expected:


With Hibernate Criteria i tried this:


But Hibernate generates the follwogin SQL:


As you can see, the generated SQL for the "anrede1" association is not correct. My question is, how can i set a projection for an association inside my criteria? ((Projections.property("anrede1"),anrede1) doesn't work...)?

Thanks in advance.

Best regards,

peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Hibernate Criteria, Projections and associations
 
Similar Threads
Hibernate Criteria object - how to... ?
Problem with Hibernate Criteria, Query by Example and "nullable=false"
ClassCastException Hibernate
ProjectionList hibernate Criteria
AND/OR in Hibernate - Criteria object