Hibernate exception stack is overridden by SetRollbackOnly
----------------------------------------------------------
Key: JBTM-667
URL:
https://jira.jboss.org/jira/browse/JBTM-667
Project: JBoss Transaction Manager
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: JTA
Affects Versions: 4.6.0
Environment: OS: windows XP.
Intel CPU
Reporter: Terry Xie
The fix in
https://jira.jboss.org/jira/browse/JBTM-66 makes the hibernate persistence
exception lost in exception stack. For example, say there is a duplicate data constraint
violation, hibernate entity manager calls calls transaction manager setRollbackOnly .
However setRollbackOnly in TransactionImple.java sets the _rollbackOnlyCallerStacktrace
which will be thrown as the exception cause later instead of the hibernate exception
source. This makes the hibernate persistence exception unable to propagate to jboss
clients. In this case, it is much more useful for hibernate exception information to be
displayed to clients instead of the setRollbackOnly stack.
The method in TransactionImple.java which throws the rollbackOnlyCallerStacktrace instead
of _theTransaction.getDeferredThrowable()
protected void commitAndDisassociate()
throws javax.transaction.RollbackException,
javax.transaction.HeuristicMixedException,
javax.transaction.HeuristicRollbackException,
java.lang.SecurityException, javax.transaction.SystemException,
java.lang.IllegalStateException
{
. . .
if(_rollbackOnlyCallerStacktrace != null) {
// we rolled back beacuse the user explicitly told us not to
commit. Attach the trace of who did that for debug:
rollbackException.initCause(_rollbackOnlyCallerStacktrace);
}
else if(_theTransaction.getDeferredThrowable() != null) {
// we tried to commit but it went wrong - attach the reason
for debug:
rollbackException.initCause(_theTransaction.getDeferredThrowable());
}
Here should be the change related to issue JBTM-66 :
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/labs/labs/jbosstm/trunk/Arjuna...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira