I have a staleless session bean with following method:
public void process(){
try {
// function which inserts some data
Properties properties = new Properties();
InitialContext ic = new InitialContext(properties);
CouponBatchSessionBeanRemote CBSBR = (CouponBatchSessionBeanRemote) ic.lookup(CouponBatchSessionBeanRemote.class.getName());
CBSBR.createCouponBatchFromPlantAppFile(batch);
} catch (Exception e1) {
context.setRollbackOnly();
try {
Properties properties = new Properties();
InitialContext ic = new InitialContext(properties);
RPMRequestSessionBeanRemote RPMRq = (RPMRequestSessionBeanRemote) ic.lookup(RPMRequestSessionBeanRemote.class.getName());
RPMRq.updateRPMRqState(RPMRQID, "E");
} catch (Exception e1) { }
}
}
Now in first try block if an error occurs transaction is rolledback. However after calling context.setrollbackonly() following try block transaction is not executed. The Exception thrown is that of transaction rollback.