Note that there are some explanatory texts on larger screens.

plurals
  1. POConfiguring persistence and orm with JPA 2
    primarykey
    data
    text
    <p>I'm having some trouble using Persistence on my jBPM project.</p> <p>My configuration is jBPM 5.4 + Hibernate + JPA 2, and I'm currently setting up the process flow to connect to a DB with persistence, through persistence.xml. I'm just trying to connect the default data source (in the H2 server) with my custom persistence.xml, but I keep getting the same error over and over again:</p> <pre><code>Unknown entity: org.jbpm.persistence.processinstance.ProcessInstanceInfo </code></pre> <p>I've manually added to my src/META-INF folder the JBPMorm-JPA2.xml the following content, but the error still persists. Can anyone help me?</p> <p>JBPMorm-JPA2.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;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_2_0.xsd" version="2.0"&gt; &lt;named-query name="ProcessInstancesWaitingForEvent"&gt; &lt;query&gt; select processInstanceInfo.processInstanceId from ProcessInstanceInfo processInstanceInfo join processInstanceInfo.eventTypes eventTypes where eventTypes = :type &lt;/query&gt; &lt;/named-query&gt; &lt;!-- ProcessInstanceInfo mapping (needed for JPA 2) --&gt; &lt;entity class="org.jbpm.persistence.processinstance.ProcessInstanceInfo" metadata-complete="true"&gt; &lt;pre-update method-name="update" /&gt; &lt;attributes&gt; &lt;id name="processInstanceId"&gt; &lt;column name="InstanceId" /&gt; &lt;generated-value strategy="AUTO"/&gt; &lt;/id&gt; &lt;basic name="processId" access="FIELD" /&gt; &lt;basic name="startDate" access="FIELD" &gt; &lt;temporal&gt;DATE&lt;/temporal&gt; &lt;/basic&gt; &lt;basic name="lastReadDate" access="FIELD" &gt; &lt;temporal&gt;DATE&lt;/temporal&gt; &lt;/basic&gt; &lt;basic name="lastModificationDate" access="FIELD" &gt; &lt;temporal&gt;DATE&lt;/temporal&gt; &lt;/basic&gt; &lt;basic name="state" access="FIELD" /&gt; &lt;basic name="processInstanceByteArray" access="FIELD" &gt; &lt;lob/&gt; &lt;/basic&gt; &lt;version name="version" access="FIELD" &gt; &lt;column name="OPTLOCK" /&gt; &lt;/version&gt; &lt;element-collection name="eventTypes" target-class="java.lang.String" access="FIELD" &gt; &lt;collection-table name="EventTypes"&gt; &lt;join-column name="InstanceId"/&gt; &lt;/collection-table&gt; &lt;/element-collection&gt; &lt;transient name="processInstance" /&gt; &lt;transient name="env" /&gt; &lt;/attributes&gt; &lt;/entity&gt; &lt;/entity-mappings&gt; </code></pre> <p>persistence.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;persistence version="1.0" xsi:schemaLocation= "http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence"&gt; &lt;persistence-unit name="IALPR" transaction-type="JTA"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;jta-data-source&gt;jdbc/jbpm-ds&lt;/jta-data-source&gt; &lt;class&gt;org.drools.persistence.info.SessionInfo&lt;/class&gt; &lt;class&gt;org.jbpm.persistence.processinstance.ProcessInstanceInfo&lt;/class&gt; &lt;class&gt;org.drools.persistence.info.WorkItemInfo&lt;/class&gt; &lt;properties&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/&gt; &lt;property name="hibernate.max_fetch_depth" value="3"/&gt; &lt;property name="hibernate.hbm2ddl.auto" value="update"/&gt; &lt;property name="hibernate.show_sql" value="true"/&gt; &lt;property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup"/&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p><strong>UPDATE:</strong></p> <p>To solve this, create a ProcessInstanceInfo.hbm.xml in the META-INF folder, with the following content:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" &gt; &lt;hibernate-mapping package="org.jbpm.persistence.processinstance"&gt; &lt;!-- access="field" for fields that have no setter methods --&gt; &lt;class name="ProcessInstanceInfo" table="ProcessInstanceInfo"&gt; &lt;id name="processInstanceId" type="long" column="InstanceId"&gt; &lt;generator class="native" /&gt; &lt;/id&gt; &lt;version name="version" type="integer" unsaved-value="null" access="field"&gt; &lt;column name="OPTLOCK" not-null="false" /&gt; &lt;/version&gt; &lt;property name="processId" access="field" /&gt; &lt;property name="startDate" type="timestamp" access="field" /&gt; &lt;property name="lastReadDate" type="timestamp" access="field" /&gt; &lt;property name="lastModificationDate" type="timestamp" access="field" /&gt; &lt;property name="state" type="integer" not-null="true" access="field" /&gt; &lt;property name="processInstanceByteArray" type="org.hibernate.type.PrimitiveByteArrayBlobType" column="processInstanceByteArray" access="field" length="2147483647" /&gt; &lt;set name="eventTypes" table="EventTypes" access="field" &gt; &lt;key column="InstanceId"/&gt; &lt;element column="element" type="string"/&gt; &lt;/set&gt; &lt;!-- NOT mapping [processInstance] field because field is transient --&gt; &lt;!-- NOT mapping [env] field because field is transient --&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>If anyone knows a good tutorial on configuring persistence for jBPM5 please do share...this is insane!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload