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?