1 Reply Latest reply on Mar 6, 2006 4:17 AM by kresho

    Merging jbpm 3.1 persistence provider into existing SessionF

    kresho

      I have a JNDI bound SessionFactory in JBoss, and I want jbpm to register it's mappings into it so I could have single transactions. I have found some mentions in the docs that this is possible, but I just cant get it to work. The JBoss log shows that jbpm has initialized and found the SessionFactory, but it doesn't register it's mappings. So queries with my own mappings work fine, but jbpm can't do anything. It just keeps throwing exceptions:

      org.hibernate.MappingException: Named query not known: TaskMgmtSession.findPooledTaskInstancesByActorIds
      

      This shows that none of the hibernate mapping files have been read.

      I use JBoss 4.0.3SP1

      My files:

      jboss-app.xml:
      <?xml version="1.0"?>
      
      <jboss-app>
       <module>
       <har>hibernate-service.xml</har>
       </module>
       <module>
       <service>jbpm.sar</service>
       </module>
      </jboss-app>


      hibernate-service.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      
      <server>
       <mbean code="org.jboss.cache.TreeCache" name="jboss.har:service=HarSecondLevelCache">
       <attribute name="CacheMode">LOCAL</attribute>
       <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
       <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
       <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
       <attribute name="EvictionPolicyConfig">
       <config>
       <attribute name="wakeUpIntervalSeconds">5</attribute>
       <!-- Cache wide default -->
       <region name="/_default_">
       <attribute name="maxNodes">50000</attribute>
       <attribute name="timeToLiveSeconds">1000</attribute>
       <!-- Maximum time an object is kept in cache regardless of idle time -->
       <attribute name="maxAgeSeconds">600</attribute>
       </region>
       </config>
       </attribute>
       </mbean>
       <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=Chip_HB">
       <attribute name="DatasourceName">java:/jdbc/ChipDS</attribute>
       <attribute name="Dialect">org.hibernate.dialect.PostgreSQLDialect</attribute>
       <attribute name="SessionFactoryName">java:/hibernate/ChipHB</attribute>
       <attribute name="CacheProviderClass">org.jboss.hibernate.cache.DeployedTreeCacheProvider</attribute>
       <attribute name="DeployedTreeCacheObjectName">jboss.har:service=HarSecondLevelCache</attribute>
       <attribute name="ReflectionOptimizationEnabled">false</attribute>
       <attribute name="MaxFetchDepth">1</attribute>
       <attribute name="ShowSqlEnabled">false</attribute>
       <attribute name="ScanForMappingsEnabled">true</attribute>
       <!--attribute name="Hbm2ddlAuto">update</attribute-->
       </mbean>
      </server>
      


      jbpm.sar contains:
      jbpm.cfg.xml:
      <jbpm-configuration>
      
       <jbpm-context>
       <service name="persistence">
       <factory>
       <bean
       class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
       <field name="isTransactionEnabled">
       <true />
       </field>
       <field name="sessionFactoryJndiName">
       <string value="java:/hibernate/ChipHB" />
       </field>
       </bean>
       </factory>
       </service>
       <service name="message"
       factory="org.jbpm.msg.db.DbMessageServiceFactory" />
       <service name="scheduler"
       factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
       <service name="logging"
       factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
       <service name="authentication"
       factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
       </jbpm-context>
      
      ... the rest is standard...
      


      hibernate.cfg.xml is standard, no changes
      META-INF/jboss-service.xml:
      <server>
       <mbean code="org.jbpm.db.jmx.JbpmService"
       name="jboss.jbpm:name=DefaultJbpm,service=JbpmService"
       description="Default jBPM Service">
       <attribute name="JndiName">
       java:/jbpm/JbpmSessionFactory
       </attribute>
       <depends>
       jboss.har:service=Chip_HB
       </depends>
       </mbean>
      </server>