[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1365) Make SeamManagedEntityManagerFactory joinTransaction if available

Michael Youngstrom (JIRA) jira-events at lists.jboss.org
Tue May 29 23:18:08 EDT 2007

    [ http://jira.jboss.com/jira/browse/JBSEAM-1365?page=comments#action_12363491 ] 
Michael Youngstrom commented on JBSEAM-1365:

Well, I guess I was assuming that part of the job of managing the transaction would be to determining how the current transaction should be accessed.  And currently ManagedPersistenceContext.getEntityManager() assumes the current transaciton is available through JNDI.

However, what if in instead of Seam activly trying to determine if you need to join a transaction or not we could leave it up to the JPA provider and how it manages transactions by changing ManagedPersistenceContext.getEntityManager() to something like this:

try {
} catch(TransactionRequiredException e) {
    //log something

Then it really wouldn't matter if Seam was managing the transaction or how the current transaction was being accessed.  This would also fix JBSEAM-1363 for me.  However, it would run the potential for a performance hit of having to handle an exception when a current transaction is not active (which would probably be more the exception than the rule).  

Another option might be once JBSEAM-1144 is in place the logic could look something like:

If (is Seam managing transactions) {
    if(active) {
} else {
    try {
    } catch(TransactionRequired) {
        //log message

That way you'd only get an exception thrown if Seam wasn't managing transactions and if there wasn't a current active transaction.

> Make SeamManagedEntityManagerFactory joinTransaction if available
> -----------------------------------------------------------------
>                 Key: JBSEAM-1365
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1365
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Spring
>    Affects Versions: 1.2.1.GA
>            Reporter: Michael Youngstrom
>         Assigned To: Michael Youngstrom
>             Fix For: 1.3.0.ALPHA
> Spring correctly assumes that if EMF.createEntityManager is called while in a transaction that the newly created EntityManager will be joined in with the current transaction.  However, in the Seam Spring Integration, when Spring calls EMF.createEntityManager we might return an existing conversation scoped EM instead of a newly created one.  In which case we need to join the current transaction if there is one since spring will not.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the seam-issues mailing list