RE: Integration with Session Beans

From: David Solis (dsoli..egosoft.com.mx)
Date: Thu Nov 14 2002 - 11:29:26 EST

  • Next message: Andrus Adamchik: "Re: Integration with Session Beans"

    Hi Andrus,

    From my point of view, the transference of Cayenne data objects to the
    client involves many synchronization problems and the solution is not
    good for extranet environments and multiple kinds of clients such as
    HTML, WAP, Web services, etc.

    See my comment bellow.

    > -----Original Message-----
    > From: Andrus [mailto:andru..bjectstyle.org]
    > Sent: Wednesday, November 13, 2002 11:10 PM
    > To: David Solis; cayenne-use..bjectstyle.org
    > Subject: Re: Integration with Session Beans
    >
    > Hi David,
    >
    > in the situation you described (no data objects transferred to the
    client)
    > using Cayenne seems to be absolutely reasonable. See my comments below
    on
    > the details.
    >
    >
    > At 04:20 PM 11/13/2002 -0600, David Solis wrote:
    > >Hi Andrus,
    > >I'm sorry I'm afraid my question wasn't specific.
    > >
    > >We developed a system based on a middleware and several presentation
    > >tiers (html, wap and web services). The middleware is based on
    services
    > >instead of data. We have several Session Beans to provide services to
    > >the presentation tier and each service could use Entity Beans to
    > >persistence.
    > >Because of development time, I want to use Cayenne instead of Entity
    > >Beans.
    >
    > So, you still have an RDBMS somewhere to save data, right?
    >
    >
    Of course

    > >I'm thinking in a Session Bean (stateless but could be stateful) as
    the
    > >façade to Cayenne data objects. I don't want to expose these data
    > >objects to the presentation tier. My main requirement is DataContext
    > >implements java.io.Serializable (already does) and my main question
    is
    > >how to manage transactions between Cayenne and a Session Bean?
    > >I'm newbie to Cayenne but I know very well Apple's EOF.
    >
    > EOF experience should be very helpful in conceptualizing stuff, though
    we
    > implement things differently...
    >
    > Anyway, correct me if I am wrong here... If any uncommitted database
    > changes are written via a java.sql.Connection, EJB container must
    commit
    > them when the time comes, right? Is this what declarative transactions
    are
    > about?
    >
    You're right

    > So, all we need in Cayenne is to configure DataNode class to avoid
    > explicit
    > commit to the database after it performs a set of insert/update/delete
    > queries. If this line of thinking is right, I can make a patch to
    Cayenne
    > to behave exactly this way when asked. So within a SessionBean you
    would
    > call DataContext.commit() that would write the changes to the database
    > without committing, hoping that container will do this somewhere
    > downstream.
    >
    It is exactly what I need. What happen to Cayenne data objects if the
    container couldn't commit the transaction? Do Cayenne data objects undo
    changes or how to undo changes?
     
    > Another possibility to fine tune the behavior is to use hooks in
    > SessionSynchronization interface. And this may work even without
    changes
    > to
    > Cayenne. Basically you would commit DataContext in "beforeCompletion"
    > method, and if it throws, the whole transaction is rolled back.
    >
    I'm afraid it isn't clear. My main concern is: Could a Stateless Session
    Bean implement the SessionSynchronization interface?

    Because of clustering, I would like to avoid Stateful Session Beans.

    > What do you think?
    >
    > Also I am really interested in how this goes, so keep this list posted
    on
    > your progress.
    >
    > ;-)
    >
    > Andrus

    Thanks



    This archive was generated by hypermail 2.0.0 : Thu Nov 14 2002 - 11:31:13 EST