|EclipseLink and a Riena server [message #586704]
||Mon, 09 August 2010 11:14
| Stephan Mann
Registered: August 2010
Because this question came up during a workshop last week I just wanted |
to post this answer for all users to refer to. If you're running a Riena
server that uses EclipseLink as persistence API, you're likely to run
into a Hessian serialization problem. The problem will show up most
likely through an exception that looks like this:
Jul 20, 2010 2:20:46 PM com.caucho.hessian.io.SerializerFactory
'org.eclipse.persistence.indirection.IndirectList' is an unknown class
There are two solutions for this problem. The first is to introduce a
dependency to org.eclipse.persistence.core into the client, thus
providing the implementation of IndirectList.
The second, and IMHO preferable, solution is to change all annotations
of @OneToMany and @ManyToMany to use eager fetching:
@ManyToManny(fetch = FetchType.EAGER)
@OneToMany(fetch = FetchType.EAGER)
In this case, EclipseLink will use Vector as the List implementation and
you'll have no problems deserializing it.
EclipseLink uses lazy loading for all List typed fields by default. It
does that by using a persistence API specific implementation of the List
interface called IndirectList . By doing this, EclipseLink does not
need to load the list before it is used.
Due to the decoupling of the Hessian serialization, the client must know
the implementation details of IndirectList to deserialize the objects.
If it doesn't, you'll see the exception above.
But since all fields need to be read (and thus loaded) to be serialized,
the advantages of lazy loading have no effect in conjunction with
serialization. So you can disable lazy loading all together (=> eager)
and remove the unnecessary dependency in your client.
Powered by FUDForum
. Page generated in 0.01651 seconds