Posted By:
Bozidar_Dangubic
Posted On:
Friday, August 10, 2001 06:57 AM
threading api is not allowed in ejbs. therefore, you cannot create threads in your session beans and hence you will not need to maintain a single transaction across multiple threads created from a session bean since this is not possible. however, if you are managing a single transaction across multiple business calls, you can do that if you setup you ejbs to manage their own transactions instead of letting container manage them. here is what you can do.
....
businessMethod1()
{
get the UserTransaction from JNDI at "java:comp/UserTransaction"
call .begin() on the user transaction
}
businessMethod2()
{
....
do some stuff here, for example
}
businessMethod3()
{
....
get the UserTransaction from JNDI again
try
{
....
business calls..
.commit() on transaction
}
catch(Exception e)
{
.rollback() on transaction
}
}