Rick,

First thing you need to do is make sure your EJB implements the
SessionSynchronization interface. That is, the class declaration for your
EJB class should include "implements SessionSynchronization". The second
thing you're going to need to do is change your EJB from stateless to
stateful. Session synchronization isn't allowed on stateless EJBs. This
makes sense, because without any state, your transaction callbacks wouldn't
know what data to operate on.


----- Original Message -----
From: "Rick Yoder" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Monday, April 23, 2001 7:24 PM
Subject: Castor and Orion (transactions)


>
> I'm attempting to use Castor as my persistence layer
> inside Orion. In order for Castor to work properly,
> it needs to be informed of the transaction boundaries.
> The way it does this is by implementing the
> javax.transaction.Synchronization and registering
> with the transactons when they started. It does this
> with code similar to the following:
>
> InitialContext ctx = new InitialContext();
> javax.transaction.TransactionManager tm =
>
(javax.transaction.TransactionManager)ctx.lookup("java:comp/UserTransaction"
);
> javax.transaction.Transaction tx = tm.getTransaction();
> tx.registerSynchronization(<castor Synchronization impl>);
>
> This code appears to be working as I've added some debug code
> to Castor to make sure the call to registerSynchronization() is
> returning. However, Orion is never calling any of the
> Synchronization methods, so Castor is never persiting any
> of the data. My question is:
>
> 1. Is this a bug in Orion?
> 2. Is there an Orion configuration parameter that I have to
>    set to tell it to call back the registerred Synchronization
>    instances?
> 3. Is this the proper way to register with Orion to be notified
>    of transaction bounndaries? I know there is the
>    javax.ejb.SessionSynchronization interface for Session
>    beans to be notified of Transaction boundaries, however
>    there is no way right now for me to do this inside Castor.
>
> A few more notes on my implementation:
> - I am using Stateless Session Beans
> - Each method of the bean is setup to use Container managed
>   transactions with a TX_REQUIRED attribute. I know that I Orion
>   is creating the transaction, because the registerSynchronization
>   code above is working.
>
> Any help would be appreciated for as of now, I do not know how to
> use Castor with Orion.
>
> Thanks,
> Rick Yoder
>


Reply via email to