Re: POJO question

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Mar 10 2005 - 09:54:31 EST

  • Next message: Mike Kienenberger: "Re: Cayenne modeler - need to generate setters and getters for primary key"

    Michael,

    All we need here is an alternative serialization mechanism for the case
    when DataObjects are crossing a certain boundary. You will pass around
    CayenneDataObject subclasses, but this shouldn't bother you as long as
    they are fully inflated and don't require a DataContext to read
    properties. The actual serialization mechanism can be optimized so that
    there is not much overhead.

    So I don't see much drawback in using Cayenne over just POJO in this case
    .... other than we need to create and test a serializer. I'll need maybe a
    few hours to write it... the question is when I get those few hours to
    spare :-)

    On the long run we should investigate adding support for serialization
    delegate to CayenneDataObject so that those private write/readObject can
    still be customized.

    Andrus

    > Hi -
    >
    > I've been using Cayenne for a few days now in a test to port a new
    > prototype project to use Cayenne from Hibernate. There's one nagging
    > concern I have so far in my trials. My persistent objects are used in
    > many circumstances that have nothing to do with their persistent
    > quality . They were just POJO's that I pass around to other classes
    > that need to access their data fields. Much of what is done in my
    > system is read only from a persistence standpoint. But what feels weird
    > is the sense that what I'm passing to my other classes is not really a
    > POJO and that if I'm not careful, the data I need to access in another
    > class is not going to be there (i.e. Hollow state). With Hibernate for
    > example, once the object has been retrieved I am
    > confident that what I'm passing around isn't going to magically become
    > disconnected from a DataContext or the like. Also much of this is
    > distributed data where it's being serialized through JMS message
    > queue's on possibly remote application servers. I realize there's
    > overhead but I can't really gauge how much more there is with Cayenne
    > vs. a POJO. Obviously inherting from a subclass adds size to the
    > serialized objects as well but I'm not familiar enough with things like
    > CayenneDataObject and the intricacies of serialization to know how much.
    >
    > Is this is just something I'm going to have to get used to or is
    > Cayenne not really what I'm looking for in the sense that 90% of what
    > I'm doing is read-only database queries. The persistent objects also
    > need to be changed inside the application but in general they won't need
    > to be committed back to the database. The changes will usually happen
    > to fields inside the subclass of the persistent objects but these fields
    > can't be transient because they need to be serialized through the JMS
    > message queues as well.
    >
    > So am I barking up the wrong tree with Cayenne? Part of my concern is
    > just being new to a large framework but I don't want to spend time
    > learning something like Cayenne if it's going to cause me more code
    > maintenance headaches then another framework (hibernate - which I
    > don't particularly care for, or another ORM framework).
    >
    > Thanks for any advice
    >
    > Michael



    This archive was generated by hypermail 2.0.0 : Thu Mar 10 2005 - 09:54:33 EST