[cdi-dev] [JBoss JIRA] (CDI-162) Support Extended Persistence Contexts in Managed beans

Scott Marlow (JIRA) jira-events at lists.jboss.org
Tue Sep 18 12:22:34 EDT 2012


    [ https://issues.jboss.org/browse/CDI-162?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12719569#comment-12719569 ] 

Scott Marlow commented on CDI-162:
----------------------------------

[~struberg]
Perhaps I have some preconceived notion about how clustering should work, that is blinding me to the underlying issue.  I admit to thinking about clustering in JBoss AS terms because that is what I am most familiar with (cluster replication will not occur in the middle of a JTA transaction in JBoss AS).  EE also doesn't define how clustering should work but for the purposes of this discussion, it would be helpful if you point out an EE implementation that does replicate "transaction in-progress" state.

I would like to point out that the unsaved changes associated with the extended persistence context are not saved to the database until a JTA transaction is associated with the extended persistence context.  At the end of the transaction commit, the changes are in the database.  If the database transaction rolls back, the changes are discarded (entities are detached).  The reason that I bring this up, is that EJB passivation will not happen if there is a JTA transaction present.  Which leaves us (IMO) with the above  question about clustering implementations that have the ability to replicate "transaction in-progress" state.   

JPA 2.0 specification 7.9.1:

[quote]
...
For stateful session beans with extended persistence contexts:
...
* When a business method of the stateful session bean is invoked, if the stateful session bean uses container managed transaction demarcation, and the entity manager is not already associated with the current JTA transaction, the container associates the entity manager with the current JTA transaction and calls EntityManager.joinTransaction. If there is a different persistence context already associated with the JTA transaction, the container throws the EJBException.

* When a business method of the stateful session bean is invoked, if the stateful session bean uses bean managed transaction demarcation and a UserTransaction is begun within the method, the container associates the persistence context with the JTA transaction and calls EntityManager.joinTransaction.
[quote]


                
> Support Extended Persistence Contexts in Managed beans
> ------------------------------------------------------
>
>                 Key: CDI-162
>                 URL: https://issues.jboss.org/browse/CDI-162
>             Project: CDI Specification Issues
>          Issue Type: Tracker
>    Affects Versions: 1.0
>            Reporter: Pete Muir
>             Fix For: 1.1 (Proposed)
>
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list