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 Question on conversational state of statefull session bean 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 "Question on conversational state of statefull session bean" Watch "Question on conversational state of statefull session bean" New topic
Author

Question on conversational state of statefull session bean

Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

Hello Friendly Ranchers,

I came across this in specs and i am unable to understand it.

A container must not passivate a stateful session bean with an extended persistence context unless the following conditions are met:[10]
•All the entities in the persistence context are serializable.
•The EntityManager is serializable

I am unable to understand what extended persistence context mean ? , i went through many existing threads but their discussion was a little unclear to me.What i understood through thier discussion
was that extended persistence means that the transaction is not boxed to a single method invocation , even if i have got it right i ll like to know more this from your inputs.


Regards,
Shroff.


OCJP-90%,OCPWCD-95%
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1669
    
  25

Hi Sagar,

The Persisteny context is part of JPA (JSR-220, Java Persistence API) and not part of this exam (it is not explained in the JSR-220, EJB core specifications). The explanation is found in the JPA specs, and let me just copy a bit about extended persistence context from there:
3.3 Persistence Context Lifetime
When an extended persistence context is used, the extended persistence context exists from the time the EntityManager instance is created until it is closed. This persistence context might span multiple transactions and non-transactional invocations of the EntityManager. The extended persistence context is enlisted in the current transaction when the EntityManager is invoked in the scope of that transaction or when the stateful session bean to which the extended persistence context is bound is invoked in the scope of that transaction.
An EntityManager with an extended persistence context maintains its references to the entity objects after a transaction has committed. Those objects remain managed by the EntityManager, and they may be updated as managed objects between transactions. Navigation from a managed object in an extended persistence context results in one or more other managed objects regardless of whether a transaction is active. When an EntityManager with an extended persistence context is used, the persist, remove, merge, and refresh operations may be called regardless of whether a transaction is active. The effects of these operations will be committed to the database when the extended persistence context is enlisted in a transaction and the transaction commits.

More about the topic can be found in the JPA specs.

Regards,
Frits
Sagar Shroff
Ranch Hand

Joined: Jun 07, 2011
Posts: 208

Hi Frits , thanks for informing me about that , can you please explain me what this line in the above snippet means
,
Navigation from a managed object in an extended persistence context results in one or more other managed objects regardless of whether a transaction is active

I dint really understood what navigation means in the current context ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on conversational state of statefull session bean