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?