Here's the code flow : Session Bean --> Pojo( working on JPA entities) --> DB. As the POJO class is doing the JPA writes, I have configured it to resource_local and using entitymanagerFactory to get entitymanager and entitymanager.gettransaction to begin and commit transactions.
In one of the scenarios, the Session bean calls one of the methods of the Pojo where it has to remove some entities. Bean's method is already in a container managed transaction so, if I try to begin or commit the entitymanager.gettransaction in Pojo's method it throws exception. Fair enough as I am not allowed to call commit in a CMT but if I do not use the entitymanager.gettransaction, the JPA updations don't reflect in DB when the CMT is commited.
Update: I assume the reason CMT is not updating the DB is because we close the entityManager before getting out of the method in the POJO. I tried annotating the method with TransactionAttributeType.NOT_SUPPORTED so that I can use entityManager.getTransaction inside but it still behaves like it's still getting called in the CMT.