We have a session bean that receieves an arraylist of objects each one containing data for an entity bean. The session bean goes through the list and creates an entity bean for each object.
That works fine but what we want is to rollback all created objects if any one of them fails. I tried a few things (other then doing remove on entity beans):
1. Marked both entity bean and session bean for CM Transaction. Made the transaction attribute "Required" on both sides. Made Session bean implement SessionSynchronization.
In this case I can see transaction start but never see beforeCompletion or afterCompletion methods of SessionSynchronization fired. The entity beans are not rolled back.
2. Marked Session bean as BM transcation and wrote my own code to start and end transaction. That did not do much either.
Any suggestions ?