I'm having a hard time using the TX_REQUIRES_NEW transaction attribute in
my Entity Beans.

In the following scenario, I want to demonstrate how to protect an Entity
Bean form being rollbacked by
a client (I don't explain the parts that are working well:name
registration, home interface creation,...).

Here is the scenario:

SimpleClient (java application) obtains a reference to myTransactionTest
(TX_BEAN_MANAGED
Session Bean with SessionSynchronization interface implemented). It then
calls the myTransactionTest .test1().

The test1() gets myTransaction (UserTransaction) from the context, issue a
myTransaction.begin and do a findByPrimaryKey on CMPSample1,
(CMP Entity Bean with TX_REQUIRES_NEW declarative transaction attribute).
If not found it creates it. Then calls setState(string) wich
set the state attribute with some string. The setState(string) calls in
another method, updateCMPSample2().

UpdateCMPSample2 does a findByPrimaryKey on CMPSample2 (CMP Entity Bean
with TX_REQUIRES_NEW declarative transaction attribute).
If not found it creates it. Then calls setState(string) wich set the state
attribute with some string. The control then returns to myTransactionTest,
wich does a rollback.

At run-time, the my container seems to hang after second setState
statement. I have to stop the server to release the DB resources. It keeps
a lock,
even if I stop my client.

>From the Server log, I see that there is a synchronization problem within
the transaction coordinator.

1-) Is there someone who has implemented a scenario similar to this one ?
(wich EJB Server)
2-) Is it illegal to have 1 bean with the TX_REQUIRES_NEW attribute to call
 a method on a second one with the same
TX_REQUIRES_NEW attribute ?

Input would be appreciated.

Alain Dessureault, IBM Canada
[EMAIL PROTECTED]

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to