eager « Default « JPA Q&A





1. How to eagerly fetch a single "default" entity from a collection in EJB3/JPA    stackoverflow.com

I have a Person entity with multiple phone numbers.

 @OneToMany(mappedBy="person", cascade=CascadeType.ALL)
 public Set<PhoneNumberOfPerson> getPhoneNumbers() {
  return phoneNumbers;
 }
Now I would like to implement a "get default phone number" method ...

2. Default eager fetching when using Annotations    forum.hibernate.org

Hello! I have a simple Domain model. "Dienst" has a property "Benutzer". When I map the entities with annotations, the "benutzer" property is always fetched eagerly. When I map the entities with the provided hbm.xml file I get my expected LazyLoadingException I think I miss something trivial, as I've not found anything in the forums, docus, or books. as it states ...