I'd like to change the jpa implementation of all systems of my company
from Openjpa to Eclipselink.
No big deal until start to test lazy loading relationship and get this
exception:
Exception [EclipseLink-7242] (Eclipse Persistence Services -
1.1.2.v20090612-r4475):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: An attempt was made to traverse a relationship
using indirection that had a null Session. This often occurs when an
entity with an uninstantiated LAZY relationship is serialized and that
lazy relationship is traversed after serialization. To avoid this issue,
instantiate the LAZY relationship prior to serialization.
This exception happens whenever I call an EJB that returns an entity with
a lazy relationship from outside the EJB container (webservice or web).
Sometimes I don't want to 'instantiate the LAZY relationship prior to
serialization.', because I don't want to work with the relationships.
Openjpa returns a empty Collection in those cases. Eclipselink returns a
Linked List that returns this exception when I try to use it.
Is there a way to configure Eclipselink to have the same behavior of
OpenJpa.