1 Reply Latest reply: Aug 12, 2011 1:19 PM by Gary Struthers RSS

Persistence config for task and session fails

Gary Struthers Newbie

I have session persistence working but when I add task persistence I get errors

 

1    11/08 18:00:51,012[main] ERROR hibernate.impl.SessionFactoryImpl.<init> - Error in named query: ProcessInstancesWaitingForEvent

org.hibernate.hql.ast.QuerySyntaxException: ProcessInstanceInfo is not mapped [select processInstanceInfo.processInstanceId from ProcessInstanceInfo processInstanceInfo where :type in elements(processInstanceInfo.eventTypes)]

...

javax.persistence.PersistenceException: [PersistenceUnit: org.drools.task] Unable to build EntityManagerFactory

...

Caused by: org.hibernate.HibernateException: Errors in named queries: ProcessInstancesWaitingForEvent

 

I map to different orm.xml files

    <persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">

        <provider>org.hibernate.ejb.HibernatePersistence</provider>

        <jta-data-source>jdbc/testDS</jta-data-source>

        <mapping-file>META-INF/orm.xml</mapping-file>

...

    <persistence-unit name="org.drools.task">

        <provider>org.hibernate.ejb.HibernatePersistence</provider>

        <mapping-file>META-INF/ormtask.xml</mapping-file>


In my main method

              EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");

    

        //Creates the Environment and sets its attributes

        Environment env = KnowledgeBaseFactory.newEnvironment();

        env.set(EnvironmentName.ENTITY_MANAGER_FACTORY,

                            entityManagerFactory);

 

In my TaskServerDaemon

        EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("org.drools.task");

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

 

Why doesn't this work?

 




  • 1. Re: Persistence config for task and session fails
    Gary Struthers Newbie

    When using both persistence units I have to use a fully qualified classname in orm.xml

          <named-query name="ProcessInstancesWaitingForEvent">

              <query>

    select

        processInstanceInfo.processInstanceId

    from

        org.jbpm.persistence.processinstance.ProcessInstanceInfo processInstanceInfo

    where

        :type in elements(processInstanceInfo.eventTypes)

              </query>

          </named-query>