We are using Weblogic server 8.1 for our EJB container and Weblogic portal 8.1 to implement our UI. We have a set of business services that are exposed as stateless session beans.
We are in the process of upgrading our hibernate version from 3.0.5 to 3.1.2.
We are using container managed transactions and each bean method runs in a JTA transaction.
Our hibernate session is scoped to the JTA transaction, hence the session is flushed and the database transaction committed when the bean method completes.
The client code needs to be able to react to hibernate ConstraintViolationException by examining the constraint name and generating an appropriate error for the user.
In 3.0.5 this all worked just fine. When we upgraded to 3.1.2, we no longer get the ConstraintViolationException. We now get an exception indicating that an application rollback has occurred.
This breaks the code in the EJB client that depends on the ConstraintViolationException.
I looked into the differences between 3.0.5 and 3.1.2 and noticed that the org.hibernate.transaction.CacheSynchronizer class has been modified to do a setRollbackOnly() if an exception is raised during the session flush. Hibernate 3.0.5 did not do this. If we remove this call to setRollbackOnly() in 3.1.2, we are able to see the ConstraintViolationException in the client.
Is this a Weblogic specific problem? Weblogic provides a version of setRollbackOnly() that takes a reason parameter, setRollbackOnly(java.lang.Throwable reason), would this method provide the desired behavior? Is there a known workaround for this issue?
Thanks for any assistance.
|