permaculture playing cards
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes PersistenceContext Collision Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "PersistenceContext Collision" Watch "PersistenceContext Collision" New topic

PersistenceContext Collision

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10032


Imagine we have a scenario wherein I have a transaction-scoped PersistenceContext created from a Stateless session bean. Now this will be propogated to call a method in a Stateful session bean that has an extended PersistenceContext. What happens in this scenario? Which will be the active PersistenceContext as seen by the container? The one from the Stateful session bean or the one from the Stateless session bean?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Prateek Kumar Singh

Joined: Jan 21, 2011
Posts: 29

Hi Joe,

the stateful session bean will find the transaction-scoped persistence context
created by the stateless session bean, and the call into the stateful session bean method will fail. There
can be only one active persistence context for a transaction

hope it will help you to find the answer.

Prateek Singh with Suman Saha

I agree. Here's the link:
subject: PersistenceContext Collision
jQuery in Action, 3rd edition