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 How to get a single database query? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "How to get a single database query?" Watch "How to get a single database query?" New topic
Author

How to get a single database query?

Adam Kreiss
Ranch Hand

Joined: Sep 12, 2005
Posts: 35
Hi everyone,

I'm trying to set up the mappings between a number of tables. I'd like to be able to retrieve them (or large sections of them) with one call to the database instead of one call for each relationship. Is there any way to get Hibernate to do this?

Thanks

- Adam
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

Well, that's what "eager" fetching is all about. Hibernate prefers "lazy" fetches, because complex tables with lots of relationships can potentially drag in the world and its dog and load all of it into memory at once. However, you can tweak the fetch process if you know that certain relationships will always go together.


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
 
IntelliJ Java IDE
 
subject: How to get a single database query?
 
Threads others viewed
Help me design this struts app , please
Using html drop down box to retain values (in a jsp page)
connection time out error
DTO & DAO
How to call stored procedures in ejb2.1?
developer file tools