Hello

I am using Wicket with Cayenne ORM and have some doubts regarding
serialization of cayenne objects in the Session. I am not sure this list is
appropriate as my question is not only about Wicket but about Wicket and
Cayenne. Please let me know if my question does not belong here.

In the past I've had problems creating models that had direct references to
cayenne objects. It seems that during the process of deserializaing said
objects when accessing versioned pages, references were set to null
(persistent state hollow) and the datacontext was lost. This caused some
NPE's to show up (especially when using the back button) or some null values
on the markup.

I then realised that the correct way to obtain these objects is via loadable
detachable models. This way, the cayenne objects themselves are never
serialized or deserialized, but are fetched on demand from the database. The
problems were solved.

However, besides the case of cayenne objects being referenced by models
which I have removed, I have cayenne objects which are stored directly in
the Session. For example, when the user logs there is a corresponding
cayenne User object that is loaded from the database and kept in the
session. For the moment I have had no problems with null references or
NPE's, but given my past problems, I am not sure this is safe.

In summary, is it safe to store Cayenne objects in the session? When are
these objects serialized? Have I had no problems to date because these
objects are kept in memory? Will I have problems when clustering, if there
is session migration going on?

Many Thanks,

David

Reply via email to