1 Reply Latest reply on Feb 28, 2011 12:04 AM by richard yang

    SMPC with ViewScoped managed bean

    Andrew Wheeler Newbie

      I'm using a ViewScoped managed bean while injecting the SMPC entityManager. The documentation says to annotate the EntityManagerFactory with @ConversationScoped. This means the SMPC will be created in the conversation scope. Does this mean that every request to a context shorter than conversation will be wrapped with a temporary conversation?

      Anyway I'm trying to merge the (detached) entity when the user presses the save button. E.g.

           public void save() {
                if (getInstance() == null)
                if (getEntityManager().contains(getInstance()))
                     if (getId() == null)

      As you can see I've annotated the method with @TransactionAttribute however I still get a transaction exception:

      java.lang.IllegalStateException: ARJUNA-16072 No such transaction!
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.setRollbackOnly(BaseTransaction.java:149)
           at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.setRollbackOnly(BaseTransactionManagerDelegate.java:123)
           at org.hibernate.ejb.AbstractEntityManagerImpl.markAsRollback(AbstractEntityManagerImpl.java:963)
           at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1156)
           at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:798)

      I'm using Seam persistence Beta3. Also as the documentation is lacking can anyone explain how to set the SMPC to manual flush when in a conversation?

      Just a small note to the Seam development team: If you document it then I can test it. I would like to see documentation as a first class citizen with regards to releases.

        • 1. Re: SMPC with ViewScoped managed bean
          richard yang Newbie

          Sorry to hijack your thread. But I asked similar question in other thread and got no response.

          I have the same question... for two months. The Seam 3 faces and persistence modules documentations are really short and lacking details.

          I would like to know how we can set manual flush in the SMPC so that the transaction can be committed independent of jsf life cycle's transaction.

          What I observed (with latest CR1 and previous beta) that in the case of view scoped or conversation scoped weld managed beans, the transaction to the database can only be committed when either the long conversation is ended or the view scoped method is ended. Our service layer is separated from controller and only the service layer (@TransactionAttribute) has SMPC (conversation scoped) injected.

          We'd like to know how the faces module work with persistence module as far as transaction is concerned. Really need some direction, please!