Skip to Main Content

Integration

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!

Lazy Load collection(one-Many) attribute and retriving after em.close()

980632Dec 18 2012 — edited Dec 20 2012
Is there a way to lazy load a collection attribute in an entity and retrivie it after calling entityManager.close().Which i mean retrival out of the entity manager context.

Code template might look like this

EntityManager em = (retrive from factory)
SampleEntity se = em.find(SampelEntity.class,45);
em.close();
se.getXXXCollection() - Here i required a lazy loading to happen out of the enity manager context

It would ideally throw a "failed to lazily initialize a collection" exception but thought of getting some suggestions from the forum whether is there any solution.

Please suggest.

Thank you

Mohan

Comments

james_sutherland
This should work if using TopLink/EclipseLink.
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jan 17 2013
Added on Dec 18 2012
1 comment
372 views