Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Jash Rathore

Greenhorn
+ Follow
since Jun 19, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jash Rathore

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.

Any Insight would be really appreciated.

Thanks