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:
•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.
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.