Serialization

From: Craig Miskell (cmiskel..lbatross.co.nz)
Date: Thu Sep 12 2002 - 20:47:56 EDT

  • Next message: Craig Miskell: "Serialization - more, partial solution, kind of"

    Hi all,
            We're using cayenne in a webapp (tomcat), and want a per-session
    datacontext. So, I used ServletConfiguration - works fine. However,
    tomcat likes to serialize it's sessions to disk when you shut down, and
    DataContext isn't serializable so it spits up all over my log files. In
    fact, I *think* it serializes to disk "at will", it's just that I've only
    ever triggered it on shutdown because I'm in a development cycle and not
    having thousands of sessions going at the same time.

    If I understand correctly, all servlet engines are much the same (and
    rightly so, especially the distributed load-balancing magical ones).

    We're also using Tapestry as the presentation layer, which has an custom
    "Visit" object for storing any session related state. I could put the
    DataContext in there, as a transient ivar. However, that would mean I
    need to create a new one when the Visit is serialized/deserialized. I'm
    not sure what the overhead of this is. Of more concern is whether
    DataContext's work in the same way as EOF EditingContexts, where data
    objects that exist in one are not valid in another (must be faulted in).
    I've had a quick look, but can't quite see if this is the case in cayenne.
    More to the point, ObjectID is not serializable, so serializing a
    CayenneDataObject subclass also barfs. So, I *think* that someone has to
    implement serializable on DataContext and ObjectID. I'm happy to do it if
    no one objects, but as I'm just diving into cayenne, I'm not sure if
    there's any big issues lurking. Any comments, caveats, warnings?

    Craig Miskell



    This archive was generated by hypermail 2.0.0 : Thu Sep 12 2002 - 20:48:04 EDT