JBoss Community

Re: JBPM's persistence reusing existing connection

created by Andres Fernandez in jBPM - View the full discussion

The second option that you are trying makes no sense at all.

You should continue trying with the first one.. looking how to create a persistence unit and inject the current session that you have available.

Great, it's good know it :) I will discard the second option and continue with the first.

 

I remember an article that explains how to create a new persistence unit using a persistence.xml file and then inject the session inside it once is created. You should try that option.

My partner is doing tested using a persistence.xml file but I think it's different that you mention. Coincidentally he gets the same error I get in my first choice.

 


EntityManagerFactory emf = Persistence.createEntityManagerFactory( "manager" ); //manager name file persistence
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

 

 

persistence.xml


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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_2_0.xsd"
             version="2.0"> 
 <persistence-unit name="manager" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
<!--     <jta-data-source>jdbc/processInstanceDS</jta-data-source> -->      
          <validation-mode>AUTO</validation-mode>
    <properties>
                    <property name="hibernate.max_fetch_depth" value="3"/>     
                    <property name="hibernate.show_sql" value="true"/>
              <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="javax.persistence.jdbc.user" value="..."/>
        <property name="javax.persistence.jdbc.password" value="..."/>
        <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@..."/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
        <property name="hibernate.max_fetch_depth" value="3"/>
    </properties>
  </persistence-unit>
</persistence>

 

 

Greetings

Reply to this message by going to Community

Start a new discussion in jBPM at Community