[rules-users] Persistence with Drools 5.1.0.M2

Mauricio Salatino salaboy at gmail.com
Fri Jul 16 18:23:14 EDT 2010


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 = :processId
          </query>
      </named-query-->
</entity-mappings>


Greetings.

On Fri, Jul 16, 2010 at 7:07 PM, Rory Farrell <rjf at bellsouth.net> wrote:

> Hi, I'm trying to get persistence working in Drools 5.1.0.M2.  I read
> through the documentation and the drools-user forum posts and made some
> progress but I'm stuck at:
>
> SEVERE: Error in named query: ProcessInstancesWaitingForEvent
> org.hibernate.QueryException: cannot dereference scalar collection
> element: name [select processInstanceInfo.processInstanceId from
> org.drools.persistence.processinstance.ProcessInstanceInfo
> processInstanceInfo where :type in (processInstanceInfo.eventTypes.name)]
>
> Here are the steps I've followed so far:
>
> 1. Read the documentation and cut and pasted the code to run and persist
> a small sample ruleflow.  I got the following exception:
>
> Caused by: org.hibernate.AnnotationException: Use of @OneToMany or
> @ManyToMany targeting an unmapped class:
>
> org.drools.persistence.processinstance.ProcessInstanceInfo.variables[org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo]
>
> 2. Read through the forum and added the following lines to the
> persistence.xml file:
>
>
> <class>org.drools.persistence.processinstance.variabletypes.VariableInstanceInfo</class>
>
> <class>org.drools.persistence.processinstance.variabletypes.JPAPersistedVariable</class>
>
> I got the following exception:
>
> Caused by: java.lang.IllegalArgumentException: Named query not found:
> ProcessInstancesWaitingForEvent
>
> 3. Read through the forum again and the only thing I found was a post
> saying to make sure that the orm.xml with the named query was in the
> META-INF directory in the drools-persistence-jpa.jar.  I checked and the
> orm.xml with the named query was in the
> drools-persistence-jpa-5.1.0.M2.jar.  I tried copying the orm.xml into a
> META-INF directory in my classpath and I got the following exception:
>
> SEVERE: Error in named query: ProcessInstancesWaitingForEvent
> org.hibernate.QueryException: cannot dereference scalar collection
> element: name [select processInstanceInfo.processInstanceId from
> org.drools.persistence.processinstance.ProcessInstanceInfo
> processInstanceInfo where :type in (processInstanceInfo.eventTypes.name)]
>
> I'm stuck at this point.  It looks like the orm.xml is not in sync with
> the Drools 5.1.0.M2 code.  I'm sure that someone must have this working.
>  If so, could you post the orm.xml file that you are using or give me a
> pointer as to where I might be going wrong?
>
> Regards,
> Rory
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100716/fe90ad5d/attachment.html 


More information about the rules-users mailing list