• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

transaction in stateless session bean with BMT

 
Ryk Lee
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

would anyone help me to make this clear :-

If a stateless session bean with BMT starts a transaction in a method and completes without committing or rolling back, what will happen? will exception be thrown? or will the bean instance be discarded?

thanks.

RL
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From 17.6.1:
If a stateless session bean instance starts a transaction in a business method, it must commit the transaction before the business method returns. The Container must detect the case in which a transaction was started, but not completed, in the business method, and handle it as follows:
� Log this as an application error to alert the system administrator.
� Roll back the started transaction.
� Discard the instance of the session bean.
� Throw the java.rmi.RemoteException to the client if the client is a remote client, or throw the javax.ejb.EJBException if the client is a local client.
 
Ryk Lee
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Satou kurinosuke:
From 17.6.1:
If a stateless session bean instance starts a transaction in a business method, it must commit the transaction before the business method returns. The Container must detect the case in which a transaction was started, but not completed, in the business method, and handle it as follows:
� Log this as an application error to alert the system administrator.
� Roll back the started transaction.
� Discard the instance of the session bean.
� Throw the java.rmi.RemoteException to the client if the client is a remote client, or throw the javax.ejb.EJBException if the client is a local client.



thank you very much
 
Mike Pandey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case of MDBs, we definitely cannot throw any Exception. But does the bean instance gets killed or Logging done by the container in the above case?

thanks.
 
Mike Pandey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case of MDBs, we definitely cannot throw any Exception. But does the bean instance gets killed or Logging done by the container in the above case?

thanks.
 
M. Imran
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The three steps will run in MDBs except sending exception to the user while a system exception generates. Those steps as mentioned above are :

� Log this as an application error to alert the system administrator.
� Roll back the started transaction.
� Discard the instance of the session bean.
 
Mike Pandey
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Imran.
But the question is about the behaviour if the transaction is left open after onMessage() completes.

Can anyone throw light on this?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a message-driven bean instance starts a transaction in the onMessage method, it must commit the transaction before the onMessage method returns. The Container must detect the case in which a transaction was started, but not completed, in the onMessage method, and handle it as follows:
� Log this as an application error to alert the system administrator.
� Roll back the started transaction.
� Discard the instance of the message-driven bean.
[ October 13, 2006: Message edited by: Satou kurinosuke ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic