http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Session6.html#wp80322
Quote:
If a system exception occurs within a transaction, the EJB container rolls back the transaction. However, if an application exception is thrown within a transaction, the container does not roll back the transaction.
now CaveatEmptorFacadeBean looks like:
Code:
public Bid bidForItem(Long userId, Long itemId, BigDecimal bidAmount) throws RemoteException {
try {
//...
HibernateUtil.commitTransaction();
}
finally {
HibernateUtil.closeSession();
}
I think it should look like:
Code:
bidAmount) throws RemoteException {
try {
//...
HibernateUtil.commitTransaction();
}
catch (InfrastructureException e) { // or any another base application level one
sessionContext.setRollbackOnly(); // to tell container to rollback current transaction
}
finally {
HibernateUtil.closeSession();
}
I don't know if hibernate Transaction.rollback() inside CMT rollbacks/marks current CMT transaction with sessionContext.setRollbackOnly()?
--
Leonid