Hi Mauricio,
Thanks for the reply. I made some progress with the orm.xml you
provided. The orm.xml in the 5.1.0.M2 distribution has the named query as:
select
processInstanceInfo.processInstanceId
from
ProcessInstanceInfo processInstanceInfo
where
:type in (processInstanceInfo.eventTypes.name)
I noticed that in the drools-persistence-jpa/src/test/resources/META-INF
directory there is an orm.xml which matches the one you provided.
After replacing the orm.xml, the ruleflow process is started
successfully. It works correctly until it comes to a human task work
item. When the work item handler attempts to complete the work item it
fails with the following exception:
java.lang.NullPointerException
at
org.drools.persistence.processinstance.JPAWorkItemManager.completeWorkItem(JPAWorkItemManager.java:85)
Line 85 is:
workItemInfo = em.find(WorkItemInfo.class, id);
The JPAWorkItemManager tries to retrieve the EntityManager from the
environment:
EntityManager em = (EntityManager)
this.workingMemory.getEnvironment().get( EnvironmentName.ENTITY_MANAGER );
and the EntityManager is not in the environment.
The EntityManagerFactory is in the environment and I see where the
SingleSessionCommandService class uses the factory to instantiate an
EntityManager, but it never gets put in the environment for the
JPAWorkItemManager to retrieve it.
If you say that the persistence works for you in 5.1.0, then I guess I
will try using the latest snapshot.
Regards,
Rory
On 7/16/2010 6:23 PM, Mauricio Salatino wrote:
I was looking that in the trunk but I don't see nothing strange
about
persistence there..
I can host a project that has the persistence configuration work if you
want.
but my maven deps are:
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-persistence-jpa</artifactId>
<version>5.1.0.SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-workitems</artifactId>
<version>5.1.0.SNAPSHOT</version>
</dependency>
and in my META-INF directory I have the following orm.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
version="1.0">
<named-query name="ProcessInstancesWaitingForEvent">
<query>
select
processInstanceInfo.processInstanceId
from
ProcessInstanceInfo processInstanceInfo
where
:type in elements(processInstanceInfo.eventTypes)
</query>
</named-query>
<!--named-query name="VariableInstancesInfoByProcessId">
<query>
select
v
from
VariableInstanceInfo v
where
v.processInstanceInfo.id <
http://v.processInstanceInfo.id> = :processId
</query>
</named-query-->
</entity-mappings>