[jboss-user] [JBoss Seam] - Problem synchronizing managed-persistence-context

cpopetz do-not-reply at jboss.com
Fri Nov 2 14:22:43 EDT 2007


I'm experiencing the following problem with seam 2.0.0CR3, hibernate 3.2.5ga, hibernate EM 3.3.1 GA.  I'm running with the embedded jboss EJB3 container that's packaged with seam, so I'm not sure of its version number, but I don't think this behavior is specific to the embedded container.

I have a managed-persistence-context and a factory to inject its session delegate, almost straight out of the manual:

<persistence:managed-persistence-context name="discussionEM"
       auto-create="true"
        persistence-unit-jndi-name="<the path to my factory>"/>

<factory name="discussionSession" auto-create="true" value="#{discussionEM.delegate}"/>


Here's the use-case.  A non-transactional method calls a method on a SFSB bean that has the discussionSession injected with @In.  When that happens, the container sets up a transaction, and when discussionEM is @Unwrapped it calls joinTransaction, the entity manager joins the transaction, and everything is cool.  That method returns, and the transaction is committed and removed.  Now my non-transactional caller calls _another_ method on the same SFSB.  This time, the container sets up a transaction, but @Unwrap is never called on discussionEM, because the discussionSession is found in the event context, and here is no component named "discussionSession" (since it's a factory), so no unwrap method is called, so no synchronization happens.

So is there something I'm doing wrong?  My feeling is that if ManagedPersistenceContext is going to do important things in @Unwrap, then @Unwrap needs to be called on every injection, which it's not (at least in this case.)   


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101409#4101409

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101409



More information about the jboss-user mailing list