File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate fetching a list" Watch "Hibernate fetching a list" New topic

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:

[] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
I agree. Here's the link:
subject: Hibernate fetching a list
It's not a secret anymore!