I'm trying to get a session bean that uses bean-managed transactions to work.  Basically, I've got a <transaction-type> of 'Bean' in my ejb-jar.xml file.  It's also a stateful session bean.  Don't know if that makes a difference or not.
 
In my code, I have the lines:
 
try {
   if(context.getUserTransaction().getStatus() != javax.transaction.Status.STATUS_ACTIVE)
      throw new EJBException("Transaction is not active!");         
context.getUserTransaction().begin();
 
context is an EJBContext I initialize during setSessionContext.  Unfortunately, it never gets that far.  There's never a transaction that is active.  It blows up in the 'if' statement:
 
javax.transaction.TransactionRolledBackException:  javax.ejb.EJBException
 
Is there something else that I need to be aware of in handling bean-managed transactions??
 
Thanks for all your help.
 
Joe
 


 

Reply via email to