Re: Storing DataObjects in Session

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri May 09 2008 - 07:13:23 EDT

  • Next message: Garcia Corral, Josep: "how can I use two different databases in one web application?"

    On May 9, 2008, at 8:31 AM, John Emmanuel wrote:

    >
    > I would like to know if it is ok to store DataObjects in session.

    Yes, as long as the DataContext that this object belongs to is also in
    the session scope. Judging from the stack trace, it is in your case.

    > I stored an employee dataobject in session and it worked fine.
    > however with every restart of tomcat
    > java.io.NotSerializableException is
    > thrown.
    > am i doing something wrong. i am using cayenne 3.0m3 and here is the
    > stack
    > trace -

    > SEVERE: IOException while loading persisted sessions:
    > java.io.WriteAbortedException: writing aborted;
    > java.io.NotSerializableException:
    > org.apache.cayenne.cache.MapQueryCache$CacheEntry
    > java.io.WriteAbortedException: writing aborted;
    > java.io.NotSerializableException:
    > org.apache.cayenne.cache.MapQueryCache$CacheEntry
    > at
    > java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333)

    This turned out to be a bug. I just fixed it on trunk. It will go in M4:

    https://issues.apache.org/cayenne/browse/CAY-1053

    Andrus



    This archive was generated by hypermail 2.0.0 : Fri May 09 2008 - 07:13:56 EDT