This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 9345


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
Similar Threads
invoking login method
why do we need ejbactivate and ejbpassivate
Differentiate stateless and stateful
change stateless to stateful session bean
What is Multiple Deployment of an EJB?