Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Riena » EclipseLink and a Riena server
EclipseLink and a Riena server [message #551731] Mon, 09 August 2010 11:14 Go to next message
Eclipse UserFriend
Originally posted by: stephan.mann.compeople.de

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:

---8<---
Jul 20, 2010 2:20:46 PM com.caucho.hessian.io.SerializerFactory
getDeserializer
WARNING: Hessian/Burlap:
'org.eclipse.persistence.indirection.IndirectList' is an unknown class
in org.eclipse.core.runtime.internal.adaptor.ContextFinder@1ee2c2c:
java.lang.ClassNotFoundException:
org.eclipse.persistence.indirection.IndirectList
---8<---

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.


Background/explanation:
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 [1]. 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.

hth, stephan

[1]
http://www.eclipse.org/eclipselink/api/2.0/org/eclipse/persi stence/indirection/IndirectList.html
Re: EclipseLink and a Riena server [message #551982 is a reply to message #551731] Tue, 10 August 2010 12:03 Go to previous message
Eclipse UserFriend
Originally posted by: stephan.mann.compeople.de

On 09.08.2010 13:14, Stephan Mann wrote:
> 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.

After some internal discussion about whether this solution is really
preferable we now have a third solution. Since it requires no change in
the domain model *and* no dependency to percistence.core in the client,
*this is* the recommended solution.

Stefan thankworthy wrote a new Hessian serializer, that is able to
serialize an IndirectList into an ArrayList. This way, one can use lazy
fetching with all its advantages and the client sees an ArrayList which
poses no problem. Keep in mind though that all data gets fetched during
serialization.

The serializer is named EclipsePersistenceIndirectListSerializerFactory
and you can get it from CVS or with the next mile stone.

stephan
Re: EclipseLink and a Riena server [message #586728 is a reply to message #551731] Tue, 10 August 2010 12:03 Go to previous message
Stephan Mann is currently offline Stephan MannFriend
Messages: 22
Registered: August 2010
Junior Member
On 09.08.2010 13:14, Stephan Mann wrote:
> 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.

After some internal discussion about whether this solution is really
preferable we now have a third solution. Since it requires no change in
the domain model *and* no dependency to percistence.core in the client,
*this is* the recommended solution.

Stefan thankworthy wrote a new Hessian serializer, that is able to
serialize an IndirectList into an ArrayList. This way, one can use lazy
fetching with all its advantages and the client sees an ArrayList which
poses no problem. Keep in mind though that all data gets fetched during
serialization.

The serializer is named EclipsePersistenceIndirectListSerializerFactory
and you can get it from CVS or with the next mile stone.

stephan
Previous Topic:Change of Plans in Riena...
Next Topic:Riena Talks
Goto Forum:
  


Current Time: Fri Mar 29 08:12:25 GMT 2024

Powered by FUDForum. Page generated in 0.03081 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top