JBoss Community

Re: TaskServer, persistence file and session

created by Marie MM in jBPM - View the full discussion

I found solution for me. It didn't work with one entity manager factory, but I managed to make it work with two.

 

Persistence.xml has in both persistence units (nearly) all classes because I use one orm.xml which merges all queries. In code I have following:

 

        EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );

        EntityManagerFactory emfTask = Persistence.createEntityManagerFactory( "org.jbpm.myTask" );

 

        Environment env = KnowledgeBaseFactory.newEnvironment();

        env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );

        env.set( EnvironmentName.GLOBALS, new MapGlobalResolver() );

 

        TaskService taskService = new TaskService(emfTask, SystemEventListenerFactory.getSystemEventListener());

 

 

I don't understand exactly why the persistence unit for process and for task are different.

If anyone makes it running with one persistence, let me know.

Reply to this message by going to Community

Start a new discussion in jBPM at Community