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 Hibernate fetching a list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate fetching a list" Watch "Hibernate fetching a list" New topic
Author

Hibernate fetching a list

Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
So I have a query that returns N entities, each with multiple layers of subdetail. Is there a way i can get Hibernate to build a join so it can populate the object hierarchy in each row from a single statement? Because today, according to the show_sql attribute being on, I can see that it is making a query for each detail element. That isn't going to scale nicely over some features.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

You can use the join fetch in the query.

Check here for more details: http://uaihebert.com/?p=1274


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate fetching a list
 
Similar Threads
Hibernate session thread safety issue
Hibernate (decode && null)
hibernate migration
Hibernate - Slow Query on Entity Superclass
Correctness in hibernate query