File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Persistence Context propagation doubt 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 "Persistence Context propagation doubt" Watch "Persistence Context propagation doubt" New topic
Author

Persistence Context propagation doubt

Aditya Vasudeva
Ranch Hand

Joined: May 27, 2008
Posts: 76
The spec says that when a persistent context is propagated, it needs an active JTA transaction. After propagation, if an entity manager is called on the component which called it, if the PersistenceContext.TRANSACTION is mentioned, then a new transaction is started.

My question is, what happens to the propagated persistence context?? What was the point of propagating it when a new transaction was to start??
Aditya Vasudeva
Ranch Hand

Joined: May 27, 2008
Posts: 76
please help......
Vinay Nath
Ranch Hand

Joined: Jul 06, 2008
Posts: 85
could you please explain the question? I couldnt understand it...

frm watever I understood frm question:

if CMT is used and persistent context is transaction scoped then

1) if a call is made to another bean using CMT, context being TrANSACTION and the method has REQUIRES_NEW then the propagated persistent context will not be used.

2) if a call is made to another bean using CMT, context being TrANSACTION and the method has REQUIRED/MANDATORY then the propagated persistent context will be used as the transaction will be propagted along with persistent context to that method.

hope it helps...


SCDJWS 5.0, SCBCD 5.0, SCWCD 5.0, SCJP 5.0
Aditya Vasudeva
Ranch Hand

Joined: May 27, 2008
Posts: 76
ok, so this means that if a transaction is not propagated, then a persistent context currently used by it will also not be propagated?? Right??
Vinay Nath
Ranch Hand

Joined: Jul 06, 2008
Posts: 85
absolutely right!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Persistence Context propagation doubt