5 Replies Latest reply on Feb 4, 2009 8:43 PM by slawek t

    flushmode=MANUAL and session.insert() problem

    slawek t Novice

      I'm using seam-2.1.2-snapshot and want to use manual hibernate session flushing.
      During long rinning conversation all my operations on managed entities (update, delete) are flushing not until session.flush() exists and it's ok but session.insert() is executed and visible in database immediately and not waiting for session.flush().


      Seam managed sessions are created like this (components.xml):


           <persistence:entity-manager-factory
                name="cmsEntityManagerFactory" persistence-unit-name="cms" />
      
           <persistence:managed-persistence-context
                name="entityManager" auto-create="true" entity-manager-factory="#{cmsEntityManagerFactory}" />
      
           <factory name="session" method="#{entityManager.getDelegate( )}" auto-create="true" />
      




      I'm using seam managed session in my seam action bean:


          @In
          private Session session;
      



      I'm beginning conversation like this:


         @Begin( flushmode = MANUAL, join = true )
          public void begin( ) {
          }
      



      I'm ending conversation in two ways depends on save or cancel button pressed:


         @End
          public String cancel( ) {
              return "admin";
          }
      
      
          @End
          public String save( ) {
              session.flush( );
              return "admin";
          }
      




      I've tried also setting flushmode as MANULA in components.xml (with the same result)


      What's wrong in my approach? There is still unresolved issue JBSEAM-1678 but I don't know if it's directly related to my problem.


      If it's known issue, is there any way to bypass it?


      slawek