storing persistence data object in database tables

820 views
Skip to first unread message

masoud jabbarvand

unread,
May 2, 2016, 2:56:35 AM5/2/16
to jBPM Usage
Hi
I want to store persistence "data object" in database and i follow instructions of this link.
1. first i create persistable data object and add fields to that
2. then i add table name and column name for every fields from Persistence Domain Screen.
3. then in persistence descriptor of project In the Advanced properties section, i change hibernate.dialect to org.hibernate.dialect.PostgreSQLDialect. (since i use postgres)
4. and in the
roject persisteable Data Objects section i select Add project persistable classes button.
5.
then i build and deploy project but i get this error : Caused by: [Error: could not create constructor: null] [Near : {... new org.drools.persistence.jpa.mar ....}]
6.
then i delet [new org.drools.persistence.jpa.marshaller.JPAPlaceholderResolverStrategy("demo:dataObject:1.0", classLoader)} from marshaling strategies in
Deployment Descriptor editor and then i could build successfully but the tables i expect not created in database!
tnx in advance.

Maciej Swiderski

unread,
May 2, 2016, 6:46:12 AM5/2/16
to masoud jabbarvand, jBPM Usage
this error means the entity manager factory failed for your persistence unit. Please check if your persistence.xml (within your project) has valid entries, such as JNDI name for data source so it can access and use it to create tables etc.

Maciej
--
You received this message because you are subscribed to the Google Groups "jBPM Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbpm-usage+...@googlegroups.com.
To post to this group, send email to jbpm-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbpm-usage/efa4138a-e909-4b4e-bf93-e08be63a236d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

masoud jabbarvand

unread,
May 2, 2016, 8:50:06 AM5/2/16
to jBPM Usage, m.jabb...@gmail.com
Hi Maciej,  and thanks.

my persistence.xml file in project is this:
----------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd
 http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">
    <persistence-unit name="org.jbpm:dataObject:1.0" transaction-type="JTA">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:comp/env/jdbc/jbpm</jta-data-source>
        <class>demo.dataobject.shape</class>
        <class>demo.dataobject.course</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.max_fetch_depth" value="3"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.id.new_generator_mappings" value="false"/>
            <property name="hibernate.transaction.jta.platform"
            value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>
            <property name="hibernate.jndi.class" value="bitronix.tm.jndi.BitronixInitialContextFactory"/>

        </properties>
    </persistence-unit>
</persistence>
----------------------------------------------------
and kie-deployment-descriptor.xml is this:

<?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/>
    <event-listeners/>
    <task-event-listeners/>
    <globals/>
    <work-item-handlers>
        <work-item-handler>
            <resolver>mvel</resolver>
            <identifier>new org.jbpm.process.workitem.webservice.WebServiceWorkItemHandler(ksession, classLoader)</identifier>
            <parameters/>
            <name>WebService</name>
        </work-item-handler>
        <work-item-handler>
            <resolver>mvel</resolver>
            <identifier>new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler()</identifier>
            <parameters/>
            <name>Log</name>
        </work-item-handler>
        <work-item-handler>
            <resolver>mvel</resolver>
            <identifier>new org.jbpm.process.workitem.bpmn2.ServiceTaskHandler(ksession, classLoader)</identifier>
            <parameters/>
            <name>Service Task</name>
        </work-item-handler>
        <work-item-handler>
            <resolver>mvel</resolver>
            <identifier>new org.jbpm.process.workitem.rest.RESTWorkItemHandler()</identifier>
            <parameters/>
            <name>Rest</name>
        </work-item-handler>
    </work-item-handlers>
    <environment-entries/>
    <configurations/>
    <required-roles/>
    <remoteable-classes/>
</deployment-descriptor>
----------------------------------------------------
whats your opinion? where is the problem?

در دوشنبه 2 مهٔ 2016، ساعت 15:16:12 (UTC+4:30)، Maciej Swiderski نوشته:

masoud jabbarvand

unread,
May 3, 2016, 4:54:34 AM5/3/16
to jBPM Usage, m.jabb...@gmail.com
Maciej ,
when i use below configuration I encounter an unusual behavior:
  • when I select build & deploy button, project not built successfully but tables are created in database. (error is like: Caused by: org.hibernate.service.jndi.JndiException: unable to find transaction manager)
  • then when i delete "Marshalling strategy" from kie-deployment-descriptor.xml the project built successfully but tables not been created.

where is the problem?


-------------- configuration

    <persistence-unit name="org.jbpm.domain" transaction-type="JTA">


        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:comp/env/jdbc/jbpm</jta-data-source>
        <class>demo.dataobject.shape</class>
        <class>demo.dataobject.course</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
            <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"/>
            <property name="hibernate.jndi.class" value="bitronix.tm.jndi.BitronixInitialContextFactory"/>
        </properties>
    </persistence-unit>
</persistence>

------------------------------------------


در دوشنبه 2 مهٔ 2016، ساعت 17:20:06 (UTC+4:30)، masoud jabbarvand نوشته:

Maciej Swiderski

unread,
May 3, 2016, 8:07:42 AM5/3/16
to masoud jabbarvand, jBPM Usage
it looks you’re running on tomcat and thus JBossAppServerJtaPlatform is not a good choice. you should use the bitronix one instead https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/kie-server-parent/kie-server-tests/pom.xml#L236

Maciej

masoud jabbarvand

unread,
May 3, 2016, 8:50:37 AM5/3/16
to jBPM Usage, m.jabb...@gmail.com
exactly the right point.
tnx again Maciej...

در سه‌شنبه 3 مهٔ 2016، ساعت 16:37:42 (UTC+4:30)، Maciej Swiderski نوشته:
Reply all
Reply to author
Forward
0 new messages