Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Does JPA has limit for default FetchType.EAGER?

holodSep 23 2008 — edited Oct 27 2008
I'm using EJB3 JPA with OpenJPA implementation.

I have an +@Entity Person+.
I get it from context. I can asses another +@Entity Institution+ using +@Entity Person+.
em.createQuery("select p from Person p");
Person -> getMandate -> getConvocation -> getInstitution
Institution has several fields. Field id +(key field)+ is retrieved, but field title doesn't.

Seems like because of too long way to Institution from Person, adapter in Runtime sets FetchType.Lazy for fields of entities which are far away from target entity.

Is it possible? Is there any way to put away this limitation
I don't want to manually invoke getters of instances in EBJ method where Person is retrieved:
List<Person> personList = em.createQuery("select p from Person p").getResultList();
for(Person p : personList){
    p.getMandate().getConvocation().getInstitution();
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 24 2008
Added on Sep 23 2008
5 comments
610 views