1 Reply Latest reply on Aug 15, 2010 11:35 AM by Boss Dida

    How Atomic Conversation Can Be Implemented ?

    Boss Dida Newbie

      Hi all,
      I want to implement an atomic conversation, and as far as I understand I use SMPC, inject EntityManager from javax.persistence API, use JPA with Hibernate persistence provider, use Generic Generator for my entity for MySQL db and begin conversation with manul flush but it still saves entity to DB when entityManager.persist() is invoked.


      (It was working with those settings once upon a time in the same project and same pc, but I've made some modifications to project for other testing purposes and not I'm non able to make it work again :( )


      I just don't get it, where is the problem ?


      And one more question. I want to change the default entityManager name to someting else let's say ex. I do it in componenets.xml at;


      <persistence:managed-persistence-context name="ex" auto-create="true" persistence-unit-jndi-name="java:/PhoneBookEntityManagerFactory"/>

      after that modification, app cannot find the entity manager, if that is wrong, I wonder what is is the way of doing this right.


      Thanks for any help.




        • 1. Re: How Atomic Conversation Can Be Implemented ?
          Boss Dida Newbie

          Whoever interests when I declare flush mode in components.xml as MANUAL


          <core:manager concurrent-request-timeout="500"
                           conversation-timeout="120000"
                           conversation-id-parameter="cid"
                           parent-conversation-id-parameter="pid"
                           default-flush-mode="MANUAL"/>


          like this, it does atomic conversation. However when I declare it with annotation while begining a long-running conversation


               @Create
               @Begin(flushMode=FlushModeType.MANUAL)
               public void init() { }

          like this, it saves entity to DB at first encounter of entityManager.persist(whatsoever)


          Something is inconsistent here I guess