aspose file tools*
The moose likes Object Relational Mapping and the fly likes List query annotation ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "List query annotation ?" Watch "List query annotation ?" New topic
Author

List query annotation ?

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
Does Hibernate have a List annotation to load this List in the LAZY mode ? something like this



Thanks.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

A one-to-many can be easily mapped by using your class associations themselves. Here's an example of a Team having many Players:



The FetchType attribute can be set to EAGER, or as you seem to prefer, LAZY.

Mapping Lazy One to Many Associations with JPA (Java Persistence API)

-Cameron McKenzie
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
The problem is Hibernate don't allow more than two EAGER at same time. Therefore most of time, we have to use LAZY. In the lazy mode, then we have to decide where to load the collection.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: List query annotation ?