I have implemented a SLSB as my facade, and using Hibernate 3.2 for DAO. I use EJB2.0. This is deployed on weblogic9.2
I am trying to implement optimistic concurrency. When I get the message StaleObjectStateException, Hibernate does a setRollback.
I am not able to catch this exception in my EJB. The control never comes back to my EJB. I would like to catch it and throw a meaningful exception (OptimisticConcurrencyException) to the client.
What the CLient gets is weblogic.transaction.internal.AppSetRollbackOnlyException. How do I catch the StaleObjecTException.
Also, how is this different from a JDBC exception. When I get a JDBCException, the transaction is rolled back, but I get control in the exception block of my EJB
Also - will not a RuntimeException be automatically rolledback by a container. Is HibernateException not a RuntimeException? Then why is there a need to explicitly do a setRollBackOnly
EJB
public void update()
{
try{
dao.saveOrUpdate();
}
catch(Exception e) {
e.printStackTrace();l
}
|