JBPM data object (persistent) external table relation with process info

900 views
Skip to first unread message

Vivek Exclusive

unread,
Jan 22, 2018, 11:36:06 AM1/22/18
to jBPM Development
Hello Team,

I am using jbpm 7.5 and mysql and  created data object nasscom and software(i.e list type inside nasscom) with type persistent  ,so totally 3 tables were created in  mysql DB  with the mentioned columns
1.nasscom                --> id,location
2.software,                 -->id,softwarename,softwareversion
3.nasscom_software-->nasscom_id,softwares_id

so now how can i filter the records from nasscom and software tables based on the process instance id/task related id. Looks like no process and task information associated with this tables.
Please do let me know what is the relation ship with this external tables with default database tables.

if i look into the variableinstance table it contains the values as like this "com.myteam.xerox.nascom@79df1070"

taskvariableimp  table also contains the same kind of value only. 'com.myteam.xerox.nascom@79df1070'

please find my persistence.xml and deployment descriptor here:

deployment descriptor:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<deployment-descriptor xsi:schemaLocation="http://www.jboss.org/jbpm deployment-descriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <persistence-unit>org.jbpm.domain</persistence-unit>
    <audit-persistence-unit>org.jbpm.domain</audit-persistence-unit>
    <audit-mode>JPA</audit-mode>
    <persistence-mode>JPA</persistence-mode>
    <runtime-strategy>SINGLETON</runtime-strategy>
    <marshalling-strategies>
        <marshalling-strategy>
            <resolver>mvel</resolver>
            <identifier>new org.drools.persistence.jpa.marshaller.JPAPlaceholderResolverStrategy("com.myteam:xerox:1.0.0", classLoader)</identifier>
            <parameters/>
        </marshalling-strategy>
    </marshalling-strategies>
    <event-listeners/>
    <task-event-listeners/>
    <globals/>
    <work-item-handlers/>
    <environment-entries/>
    <configurations/>
    <required-roles/>
    <remoteable-classes/>
    <limit-serialization-classes>true</limit-serialization-classes>
</deployment-descriptor>

persistent.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <persistence-unit name="com.myteam:xerox:1.0.0" transaction-type="JTA">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
        <class>com.myteam.xerox.nascom</class>
        <class>com.myteam.xerox.software</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.max_fetch_depth" value="3"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="false"/>
            <property name="hibernate.id.new_generator_mappings" value="false"/>
            <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>
        </properties>
    </persistence-unit>
</persistence>

Thanks in Advance

Regards,
Vivek Rajagopal

Maciej Swiderski

unread,
Jan 23, 2018, 2:27:59 AM1/23/18
to Vivek Exclusive, jBPM Development

On 22 Jan 2018, at 17:36, Vivek Exclusive <viveks.E...@gmail.com> wrote:

Hello Team,

I am using jbpm 7.5 and mysql and  created data object nasscom and software(i.e list type inside nasscom) with type persistent  ,so totally 3 tables were created in  mysql DB  with the mentioned columns
1.nasscom                --> id,location
2.software,                 -->id,softwarename,softwareversion
3.nasscom_software-->nasscom_id,softwares_id

so now how can i filter the records from nasscom and software tables based on the process instance id/task related id. Looks like no process and task information associated with this tables.
Please do let me know what is the relation ship with this external tables with default database tables.
take a look at this article that introduces VariableEntity that can be useful for your use case http://mswiderski.blogspot.com/2016/01/advanced-queries-in-jbpm-64.html

if i look into the variableinstance table it contains the values as like this "com.myteam.xerox.nascom@79df1070"

taskvariableimp  table also contains the same kind of value only. 'com.myteam.xerox.nascom@79df1070
implement toString for these objects to print relevant information into the log tables

Maciej
--
You received this message because you are subscribed to the Google Groups "jBPM Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-developme...@googlegroups.com.
To post to this group, send email to jbpm-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-development/d430bb78-b3ee-4794-929f-12ed4b3d77d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vivek Exclusive

unread,
Jan 26, 2018, 1:22:29 AM1/26/18
to Maciej Swiderski, jBPM Development
Hello Maciej,

as you mentioned  in the document i have done the following things please find the below observations:

1.created nasscom  class extends org.drools.persistence.jpa.marshaller.VariableEntity
2. created  software class  extends org.drools.persistence.jpa.marshaller.VariableEntity
3.added 
<dependency>
    <groupId>org.drools</groupId>
    <artifactId>drools-persistence-jpa</artifactId>
    <version>7.5.0.Final</version>
</dependency>

 to pom.xml

4. In persistence.xml updated the datasource and mysql dialect (i am using mysql)
5. Click the button "Add Project Persistable classes" under Project persistable Data Objects of   persistence.xml
7. then i manually entered the "org.drools.persistence.jpa.marshaller.MappedVariable'  in the text box then click  the same button .so this class also created.

so when i try create form for this data objects it was keep on loading and i was not able to proceed with creating of forms of this data object.
complied succeefully but getting lot of warning in like below.
even i added few more dependencied like this then also getting same warnings.


mypersistence.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <persistence-unit name="com.myteam:xerox:1.0.0 " transaction-type="JTA">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
        <class>com.myteam.school.Staff</class>
        <class>com.myteam.school.employee</class>
        <class>org.drools.persistence.jpa.marshaller.MappedVariable</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.max_fetch_depth" value="3"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="false"/>
            <property name="hibernate.id.new_generator_mappings" value="false"/>
            <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>
        </properties>
    </persistence-unit>
</persistence>


my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.myteam</groupId>
  <artifactId>school</artifactId>
  <version>1.0.0</version>
  <name>school</name>
  <description></description>
  <dependencies>
    <dependency>
      <groupId>org.codehaus.jettison</groupId>
      <artifactId>jettison</artifactId>
      <version>1.3.8</version>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-persistence-jpa</artifactId>
      <version>7.5.0.Final</version>
    </dependency>
    <dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
      <version>1.1.6</version>
    </dependency>
    <dependency>
      <groupId>dom4j</groupId>
      <artifactId>dom4j</artifactId>
      <version>1.6.1</version>
    </dependency>
  </dependencies>
  <repositories>
    <repository>
      <id>guvnor-m2-repo</id>
      <name>Guvnor M2 Repo</name>
    </repository>
  </repositories>
</project>



deployment  descriptor.xml


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<deployment-descriptor xsi:schemaLocation="http://www.jboss.org/jbpm deployment-descriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <persistence-unit>org.jbpm.domain</persistence-unit>
    <audit-persistence-unit>org.jbpm.domain</audit-persistence-unit>
    <audit-mode>JPA</audit-mode>
    <persistence-mode>JPA</persistence-mode>
    <runtime-strategy>SINGLETON</runtime-strategy>
    <marshalling-strategies>
        <marshalling-strategy>
            <resolver>mvel</resolver>
            <identifier>new org.drools.persistence.jpa.marshaller.JPAPlaceholderResolverStrategy("com.myteam:xerox:1.0.0 ", classLoader)</identifier>
            <parameters/>
        </marshalling-strategy>
    </marshalling-strategies>
    <event-listeners/>
    <task-event-listeners/>
    <globals/>
    <work-item-handlers/>
    <environment-entries/>
    <configurations/>
    <required-roles/>
    <remoteable-classes/>
    <limit-serialization-classes>true</limit-serialization-classes>
</deployment-descriptor>


error log:


Inline image 1

Inline image 2

Inline image 3

Inline image 4
Maciej

To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-development+unsubscribe@googlegroups.com.
To post to this group, send email to jbpm-development@googlegroups.com.

Maciej Swiderski

unread,
Jan 26, 2018, 2:09:18 AM1/26/18
to Vivek Exclusive, jBPM Development
you need to add drools-persistence-jpa with scope provided
<dependency>
    <groupId>org.drools</groupId>
    <artifactId>drools-persistence-jpa</artifactId>
    <version>7.5.0.Final</version>
    <scope>provided</scope>
</dependency>

and that should get rid of most if not all the warnings. Don’t add anything else if you don’t really need it.

Maciej

<image.png>

<image.png>

<image.png>

<image.png>

Vivek Exclusive

unread,
Jan 26, 2018, 2:30:01 AM1/26/18
to Maciej Swiderski, jBPM Development
if i use  drools-persistence-jpa with scope provided  when i compile  build getting failed with below error message.

org.drools.persistence.jpa.marshaller.VariableEntity cannot be resolved to a type  on  my dataobject name (software.java as well as nasscom.java)

Maciej Swiderski

unread,
Jan 26, 2018, 2:49:59 AM1/26/18
to Vivek Exclusive, jBPM Development
then it shows an issue with workbench build process.

you can add manually drools-persistence-api and drools-persistence-jpa to workbench/WEB-INF/lib to workaround this issue.

Maciej

Vivek Exclusive

unread,
Jan 26, 2018, 5:01:32 AM1/26/18
to Maciej Swiderski, jBPM Development
Hello Maciej,

You are great.It working now as expected.Thank you so much.

carlos conde santos

unread,
Feb 21, 2019, 6:38:17 AM2/21/19
to jBPM Development
Hi Vivek!

In a task form, I have a variable (for example, "clients"), in the form I enter it as a ListBox, in doing so it gives me the option to manually enter the possible values of that ListBox, but I want to see the names of clients that I have in a table called "clients" within a microsoftsql database (mssql).
My questions:
- how do you do it? hehe
- How do I create persistent data objects?
- how do I relate them to my jbpm variable?

Could you teach me how you did it?

Thank you!!
Reply all
Reply to author
Forward
0 new messages