Re: Stored Procedure Query and Transactions

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Mar 01 2005 - 22:13:33 EST

  • Next message: Andrus Adamchik: "Re: Help with Cayenne Deployment?"

    On Mar 1, 2005, at 10:40 AM, Wadher, Bhagwanji wrote:
    > with cayenne managed transaction in EJB, it does not commit changes
    > done
    > by storedProcA when storedProcB fails but it does commit those changes
    > when I call the same ejb method second time.

    Hmm, not sure if this is a good idea to use Cayenne transactions within
    EJBs anyways, so I'd avoid this option.

    > with container managed transaction in EJB, it does commit the changes
    > done
    > by storedProcA even when storedProcB fails.

    This should be the way to go...

    As I don't use EJB that often, I just revisited my EJB example
    (http://objectstyle.org/cayenne/examples/ejb-facade/index.html) to see
    that everything works fine. What I noticed was missing from it is an
    XDoclet transaction tag. Once I added..jb:transaction type="Required"
    for each EJB method, rollbacks started to work properly (surprise!).

    So make sure that your EJBs are deployed within a transaction context
    (use an appropriate transaction type for your app, e.g. "required" or
    "mandatory").

    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Mar 01 2005 - 22:13:38 EST