Hi,
I've just met with this UnexpectedException in an other scenario; where I was doing programmative rollback in my code, but wanted to return a value from the TransactionCallback.
While earlier it worked, this is not possible now, since the code throws an exception which swallows the return value.
For example I've had:
Code:
Integer id = transtemplate.execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) {
// will be rolled back
status.setRollbackOnly();
// do some speculative calculation in db that's going to be rolled back
return result;
}
});
As a workaround I throw now a special exception which contains the result value, but I feel this is not very nice as is. Is there any other way doing it?
Regards,
Zoltan
[/code]