Reputation: 8704
I am working on EclipseLink and for performance reasons we have set the FetchType.lazy wherever we have OneToMany relationship. Now, the the persitence is in layer 1 which has other business logic as well and then there are some other EAR which uses the persitence from layer 1. While fetching these objects i ran into an issue where elipselink threw ClassCast exception. A little digging into the issue revealed that it is because of lazy loading across multiple ear.
Now what i am thinking is to create a method with in layer 1 which will be called by other ear's IF they want to load ALL the objects i.e. eager loading mechanism. I was wondering how can i achieve this in eclipselink?
Upvotes: 1
Views: 694
Reputation: 18379
EclipseLink defines load groups that allow relationships to be forced to be loaded. The copy API can also be used to force loading.
See, http://wiki.eclipse.org/EclipseLink/Examples/JPA/AttributeGroup
Upvotes: 1
Reputation: 3634
EAR's should not depend on each other like you're doing. You're going to create a whole host of issues monkeying with the class loader.
If you have multiple services or webapps that interact, they should be in the same ear. If they are not, then copy the common jar files to the different ears.
Upvotes: 0