Re: Cayenne and EJB

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Apr 11 2010 - 09:47:04 EDT

  • Next message: Marek Šab: "Optimistic Locking problem"

    Hi Michael,

    I am not aware of any tutorials specifically dealing with EJB
    integration, but it should definitely be possible to use Cayenne. Two
    things I can think about that may help in the EJB environment:

    1. Checking "container managed transactions" for the DataDomain in the
    modeler. This would prevent Cayenne from committing JDBC connections,
    letting the container handle that.

    2. Use thread-bound ObjectContext
    (BaseContext.bindThreadObjectContext(..)), so that the same context
    and its ojects can be shared between all EJBs in the same transaction.
    (there may be other patterns of context use as well, this is just most
    common and natural one).

    Andrus

    On Apr 11, 2010, at 2:04 PM, Michael K wrote:
    > Hi,
    >
    > I'm new to cayenne, and I would like to find out whether it is
    > possible to use Cayenne in my EJB3.0 project?
    > My plan is to use Cayenne as a persistence engine rather than using
    > the standard EJB entity.
    > If possible, are there any samples or tutorials that show me where
    > to start?
    >
    >
    > Thanks in advance.
    >
    >
    > Michael



    This archive was generated by hypermail 2.0.0 : Sun Apr 11 2010 - 09:47:46 EDT