Hi,

On Wed, 25 Jun 2003 01:10:01 -0400, tek1 wrote:

>At 21:22 03/06/24 +0000, you wrote:
>>This one time, at band camp, tek1 said:
>>
>>t>I'm using CastorJDO with my J2EE application to obtain the JDO reference
>>t>from JNDI. Everything is working fine, except for the transaction
>>t>management. When an exception occurs, the operations performed by Castor
>>t>are not rolled back, even though the below is specified in the CastorJDO
>>MBean:
>>t>
>>t>_jdo.setTransactionManager("java:/TransactionManager");
>>
>>This is perplexing because the DatabaseImpl.rollback() method calls
>>TransactionContext.rollback() which should rollback anything in Castor's
>>transactional context. What types of results are you seeing? Please
>>explain what's happening and we'll see if we can work through it or I'll
>>build a simple test case for it.
>>
>>Bruce
>
>
>Hi Bruce.
>
>Thanks for your reply.
>
>Basically, I have a Stateless Session Bean ("A") with methods a() and b():
>
>
>A
>===
>public void a() <-- called by web client
>protected void b(Database db)
>
>
>1. a() obtains the JDO instance from JNDI, and from the JDO instance,
>obtains a Database instance.
>2. In performing the business logic, a() makes a call to b(), in which a()
>passes the Database instance to b().
>3. b() performs does a db.load(class,id) on an object, and changes the
>value of one of the object's attributes using setXXX().
>4. b() returns a value (that it computed) to a().
>5. At some point in the remainder of a()'s execution, an exception occurs.

What are you doig with this exception ? If you are planning to use container-managed transactions (and that's how I
understand your use case), make sure that the right kind of exception is propagated up the exceution chain. If you
simply catch your application exception, log an error but prevent the exception from bubbling up, how should the
container know that it should rollback your transaction ? I migth be completely wrong with this question, but it seems
worth asking at least.

>6. The changes made to the object in b() are not being rolledback. When I
>check the database, the value has been changed/committed, when it should
>not have been... :(
>
>Thinking that the cause may have been because I did not set a()'s
>transaction attributes in ejb-jar.xml, I then added the "Required"
>transaction attribute for a().
Looking at this, I was just about to ask whether you specified in the deployment descriptor of your web app that
(global) transactions are required when invoking methods of your EJBs. Having said that, it might be worth to specify
such attribute for b() as well. Please make sure that you use a different transaction type (whose name I simply cannot
remember right now), i.e. one where an existing transaction is usef if available, otherwise a new one will be started.

Werner

However, after restarting JBoss and
>re-running my application, the result was the same. :(
>
>My environment is:
>-J2SE-1.4.1_03 (Sun)
>-JBoss-3.2.1
>-Castor-0.9.4.3
>-Postgresql-7.3.2
>-pg73jdbc3.jar
>
>
>Any suggestions are greatly appreciated...
>
>-----------------------------------------------------------
>If you wish to unsubscribe from this mailing, send mail to
>[EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>




Reply via email to