My apologies if this has been answered a hundred times already - I didn't see this specific question addressed when I searched the forums.
I have the following situation:
1) a servlet calls a method in a worker class (POJ, nothing special).
2) the worker class calls a method on a stateless session EJB (we'll call this Bean1.method1()). The method's transaction attribute in ejb-jar.xml is "Required".
3) Bean1.method1() loops over a List. Each time through the loop, it calls a method some other class (the class could be different each time through the loop, or be the same sometimes or all the time). In every case, the class calls a method on some other stateless session EJB (each different class has its own bean class that is called). The method's transaction attribute in every case is "Required".
4) The class method returns a boolen to Bean1.method(). If the return value is false, Bean1.method() calls SessionContext.setRollbackOnly and throws an Exception.
So the basic picture is:
public boolean method1()
for(list has more items)
this could also be of type MyOtherObject, MyThirdObject, etc. In other words, it's not just one type of class possible here.
MyObject mo = (MyObject)list.get(index)
boolean ret = mo.callSomeEJB();
throw new Exception("EJB call " + index + " failed!");
(leaving out the Exception handling for space).
What we expect to happen here is that since Bean1.method1() has started a transaction, and the other bean methods that get called along the line have transaction attributes of "Required" that if one of the things in the loop returns false, everything done up to that point would be rolled back. However, what we are actually experiencing is that nothing is rolled back.
To simplify things a bit, we tried a little experiment (separate set of classes) where we had a POJ class call into a stateless session bean and had that bean call into 3 other stateless session beans directly - everything in ejb-jar.xml is marked transaction "Required". When we forced a rollback there, it worked like a charm. So in our main application, we took out the POJ class calls in the loop and had Bean1.method1() call directly into the other bean methods. But when we forced a rollback in that context, nothing was actually rolled back.
We are using J2SE 1.3.1, J2EE 1.3.1, and JBoss 3.2.2 - we've tried this with both MySQL 4.0.18 and the JConnector driver and Oracle 8.1.7 with the Oracle thin driver - we get the same behavior from both attempts in both databases. We're really at a loss as to what we're doing that would seemingly cause this to work in one application and not work in the other. Can anyone think of something we might want to check? I know I've rambled on forever already, but I'd be happy to provide more information if you think it'll help solve my problem.
Thanks in advance,