3 Replies Latest reply on Oct 28, 2009 2:40 PM by David Martin

    9.3.3. Seam-managed persistence contexts and atomic conversations

    David Martin Newbie

      Hello,


      I'm trying to set auto flushing to manual using the components.xml:


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


      This does not work; but, I have had success in beginning a long running conversation with the flush mode set to manual:


      @Begin(join=true, flushMode=FlushModeType.MANUAL)


      I am using SEAM 2.2.0.GA along with Richfaces 3.3.1.GA running on the JBOSS AS 5.1.0.GA.  I am curious if this could be a configuration setting that I am not aware of.  Below are my components.xml and persistences.xml files.  Getting this to work would be a huge time saver.


      I appreciate any help



      COMPONENTS.XML

      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
      xmlns:async="http://jboss.com/products/seam/async"
      xmlns:p="http://jboss.com/products/seam/pdf"
      xmlns:cache="http://jboss.com/products/seam/cache"
      xmlns:core="http://jboss.com/products/seam/core"
      xmlns:jms="http://jboss.com/products/seam/jms"
      xmlns:mail="http://jboss.com/products/seam/mail"
      xmlns:persistence="http://jboss.com/products/seam/persistence"
      xmlns:security="http://jboss.com/products/seam/security"
      xmlns:transaction="http://jboss.com/products/seam/transaction"
      xmlns:web="http://jboss.com/products/seam/web"
      xmlns:navigation="http://jboss.com/products/seam/navigation"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation=
                "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
                http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
                http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
                http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd
                http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
                http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.xsd
                http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.1.xsd
                http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
                http://jboss.com/products/seam/navigation http://jboss.com/products/seam/navigation-2.1.xsd
                http://jboss.com/products/seam/jms http://jboss.com/products/seam/jms-2.1.xsd
                http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.1.xsd" >
      <!--<core:init debug="false" jndi-pattern="java:comp/env/prod/#{ejbName}/local"/>-->
      <core:init debug="false" jndi-pattern="prod/#{ejbName}/local"/>
      <!--  Increased timeouts for concurrent request and conversation to support large uploads Kelly - 050808 -->
      <core:manager concurrent-request-timeout="10000" conversation-id-parameter="cid" conversation-timeout="180000" default-flush-mode="MANUAL" />
      <transaction:ejb-transaction/>
      <persistence:entity-manager-factory auto-create="true" name="dbFactory" persistence-unit-name="prodDatabase" />
      <persistence:managed-persistence-context auto-create="true"
        entity-manager-factory="#{dbFactory}" name="entityManager" persistence-unit-jndi-name="java:/entityManager" />
      <transaction:entity-transaction entity-manager="#{entityManager}"/> -->
      <security:identity authenticate-method="#{loginManager.login}"/>
      <mail:mail-session host="mailSrv.martin.com"/>
      <async:timer-service-dispatcher/>
      <factory auto-create="true" name="clientIp" value="#{facesContext.externalContext.request.remoteAddr}"/>
      <factory auto-create="true" name="userSession" value="#{facesContext.externalContext.request.session}"/>
      <factory auto-create="true" name="sessionId" value="#{facesContext.externalContext.request.session.id}"/>
      <factory auto-create="true" name="request" value="#{facesContext.externalContext.request}"/>
      <factory name="httpRequest" value="#{facesContext.externalContext.request}" auto-create="true"/> 
      <factory name="httpSession" value="#{facesContext.externalContext.request.session}" auto-create="true"/> 
      <component class="org.jboss.seam.async.ThreadPoolDispatcher" precedence="40"/>
      <!--<web:context-filter url-pattern="/servlets/*"/>  -->
      <web:exception-filter url-pattern="*.seam"/>
      <web:redirect-filter url-pattern="*.seam"/>
      <!-- <cache:jboss-cache-provider configuration="META-INF/cache/ehcache.xml" /> -->
      <jms:topic-connection auto-create="true" topic-connection-factory-jndi-name="java:/ConnectionFactory"/>
      <jms:managed-topic-publisher auto-create="true" name="nodeSystemSender" topic-jndi-name="jms/PROD.NODE.SYSTEM"/>
      <jms:managed-topic-publisher auto-create="true" name="comExecuteSender" topic-jndi-name="jms/PROD.NODE.COM.EXECUTE"/>
      <jms:managed-topic-publisher auto-create="true" name="reqExecuteSender" topic-jndi-name="jms/PROD.NODE.REQUEST.EXECUTE"/>

      </components>


      PERSISTENCE.XML

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- Persistence deployment descriptor -->
      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                   version="1.0">
           <persistence-unit name="prodDatabase">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <!-- use "java:" for jboss -->
            <jta-data-source>java:jdbc/OracleDS</jta-data-source>
            <properties>
                 <property name="jboss.entity.manager.factory.jndi.name" value="java:/entityManager" />
              <property name="hibernate.hbm2ddl.auto" value="create-drop" />
              <property name="hibernate.show_sql" value="false" />
             
              <!--  This turns on the 2nd level cache -->
                <property name="hibernate.cache.use_query_cache" value="true"/>
              <property name="hibernate.jdbc.wrap_result_sets" value="true"/>

                 <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />


              <property name="hibernate.transaction.flush_before_completion" value="true" />
           <property name="connection.release_mode" value="after_statement"/>
              <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
              <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
              <property name="net.sf.ehcache.configurationResourceName" value="/cache/ehcache.xml" />
              <property name="hibernate.cache.region_prefix" value=""/>
            </properties>
           
         </persistence-unit>
      </persistence>

        • 1. Re: 9.3.3. Seam-managed persistence contexts and atomic conversations
          David Martin Newbie

          Sorry...here are the components ans persistence xml files formatted:




          |COMPONENTS.XML
          
          <?xml version="1.0" encoding="UTF-8"?>
          <components xmlns="http://jboss.com/products/seam/components"
           xmlns:async="http://jboss.com/products/seam/async"
           xmlns:p="http://jboss.com/products/seam/pdf"
           xmlns:cache="http://jboss.com/products/seam/cache"
           xmlns:core="http://jboss.com/products/seam/core"
           xmlns:jms="http://jboss.com/products/seam/jms"
           xmlns:mail="http://jboss.com/products/seam/mail"
           xmlns:persistence="http://jboss.com/products/seam/persistence"
           xmlns:security="http://jboss.com/products/seam/security"
           xmlns:transaction="http://jboss.com/products/seam/transaction"
           xmlns:web="http://jboss.com/products/seam/web"
           xmlns:navigation="http://jboss.com/products/seam/navigation"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:schemaLocation=
                     "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd
                     http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.1.xsd
                     http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd
                     http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                     http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd
                     http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
                     http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.xsd
                     http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.1.xsd
                     http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
                     http://jboss.com/products/seam/navigation http://jboss.com/products/seam/navigation-2.1.xsd
                     http://jboss.com/products/seam/jms http://jboss.com/products/seam/jms-2.1.xsd
                     http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.1.xsd" >
           <!--<core:init debug="false" jndi-pattern="java:comp/env/prod/#{ejbName}/local"/>-->
           <core:init debug="false" jndi-pattern="prod/#{ejbName}/local"/>
           <!--  Increased timeouts for concurrent request and conversation to support large uploads Kelly - 050808 -->
           <core:manager concurrent-request-timeout="10000" conversation-id-parameter="cid" conversation-timeout="180000" default-flush-mode="MANUAL" />
           <transaction:ejb-transaction/>
           <persistence:entity-manager-factory auto-create="true" name="dbFactory" persistence-unit-name="prodDatabase" />
           <persistence:managed-persistence-context auto-create="true"
            entity-manager-factory="#{dbFactory}" name="entityManager" persistence-unit-jndi-name="java:/entityManager" />
           <transaction:entity-transaction entity-manager="#{entityManager}"/> -->
           <security:identity authenticate-method="#{loginManager.login}"/>
           <mail:mail-session host="mailSrv.martin.com"/>
           <async:timer-service-dispatcher/>
           <factory auto-create="true" name="clientIp" value="#{facesContext.externalContext.request.remoteAddr}"/>
           <factory auto-create="true" name="userSession" value="#{facesContext.externalContext.request.session}"/>
           <factory auto-create="true" name="sessionId" value="#{facesContext.externalContext.request.session.id}"/>
           <factory auto-create="true" name="request" value="#{facesContext.externalContext.request}"/>
           <factory name="httpRequest" value="#{facesContext.externalContext.request}" auto-create="true"/>  
           <factory name="httpSession" value="#{facesContext.externalContext.request.session}" auto-create="true"/>  
           <component class="org.jboss.seam.async.ThreadPoolDispatcher" precedence="40"/>
           <!--<web:context-filter url-pattern="/servlets/*"/>  -->
           <web:exception-filter url-pattern="*.seam"/>
           <web:redirect-filter url-pattern="*.seam"/>
           <!-- <cache:jboss-cache-provider configuration="META-INF/cache/ehcache.xml" /> -->
           <jms:topic-connection auto-create="true" topic-connection-factory-jndi-name="java:/ConnectionFactory"/>
           <jms:managed-topic-publisher auto-create="true" name="nodeSystemSender" topic-jndi-name="jms/PROD.NODE.SYSTEM"/>
           <jms:managed-topic-publisher auto-create="true" name="comExecuteSender" topic-jndi-name="jms/PROD.NODE.COM.EXECUTE"/>
           <jms:managed-topic-publisher auto-create="true" name="reqExecuteSender" topic-jndi-name="jms/PROD.NODE.REQUEST.EXECUTE"/>
           
          </components>|






          PERSISTENCE.XML
          
          <?xml version="1.0" encoding="UTF-8"?>
          <!-- Persistence deployment descriptor -->
          <persistence xmlns="http://java.sun.com/xml/ns/persistence" 
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" 
                       version="1.0">
               <persistence-unit name="prodDatabase">
                <provider>org.hibernate.ejb.HibernatePersistence</provider>
                <!-- use "java:" for jboss -->
                <jta-data-source>java:jdbc/OracleDS</jta-data-source>
                <properties>
                     <property name="jboss.entity.manager.factory.jndi.name" value="java:/entityManager" />
                  <property name="hibernate.hbm2ddl.auto" value="create-drop" />
                  <property name="hibernate.show_sql" value="false" />
                  
                  <!--  This turns on the 2nd level cache -->
                    <property name="hibernate.cache.use_query_cache" value="true"/>
                  <property name="hibernate.jdbc.wrap_result_sets" value="true"/>
          
                     <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
          
          
                  <property name="hibernate.transaction.flush_before_completion" value="true" />
               <property name="connection.release_mode" value="after_statement"/>
                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
                  <!-- <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/> -->
                  <!-- <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/> -->
                  <!-- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" /> -->
                  <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider" />
                  <property name="net.sf.ehcache.configurationResourceName" value="/cache/ehcache.xml" />
                  <property name="hibernate.cache.region_prefix" value=""/>
                </properties>
                
             </persistence-unit>
          </persistence>
          



          • 2. Re: 9.3.3. Seam-managed persistence contexts and atomic conversations
            Arbi Sookazian Master

            Likely root cause: <property name="hibernate.transaction.flush_before_completion" value="true" />


            Table 3.6. Hibernate Transaction Properties


            http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html


            Try removing that line...

            • 3. Re: 9.3.3. Seam-managed persistence contexts and atomic conversations
              David Martin Newbie

              Arbi...Thanks for the replay.


              I tried removing the setting in the persistence.xml and unfortunately still no luck.