[jboss-user] [jBPM] - Query task with variables

Thomas Victor do-not-reply at jboss.com
Mon May 24 10:41:00 EDT 2010


Thomas Victor [http://community.jboss.org/people/tvictor] replied to the discussion

"Query task with variables"

To view the discussion, visit: http://community.jboss.org/message/544511#544511

--------------------------------------------------------------
Hi  http://community.jboss.org/people/rebody HuiSheng Xu,

Thank you very much for replying to my post.

The way in which it works is described below.
I added the jbpm mappings to my persistence.xml. Please see the configuration below. So that my persistence unit contains the jbpm tables also. So I can use jbpm objects along with my domain objects in JPA.

The query is given below
entityManager.createQuery("SELECT new com.imagitek.prodagioap.workflow.invoice.InvoiceTask(task, invoice) from org.jbpm.api.task.Task task, org.jbpm.pvm.internal.type.Variable var, com.imagitek.prodagioap.entity.ImInvoice invoice  where var.execution=task.execution and invoice.id=var.l").getResultList();
This works because I know my variable will be a long data type.


? Right now I have a separate jbpm.hibernate.cfg.xml which is supplied by jbpm4. I am using this configuration also. Ultimately I want to use only the JPA configuration for everything. I want to get rid of the jbpm.hibernate.cfg.xml file. While creating the process engine I was able to supply hibernateSessionFactory which is provided by jpa/seam to the process engine. Then I was able to get rid of the jbpm.hibernate.cfg.xml. but the problem was that no data was persisted to the database. But all the rules, events etc were getting fired. I assume I am missing some transaction related stuff. Can please tell me what are the things I need to do to persist the data. 


Thanks & Regards
Thomas Victor




   <persistence-unit name="prodagioAP" transaction-type="JTA">
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>java:/prodagioAPDatasource</jta-data-source>
        <mapping-file>jbpm.repository.hbm.xml</mapping-file>
<mapping-file>jbpm.execution.hbm.xml</mapping-file>
<mapping-file>jbpm.history.hbm.xml</mapping-file>
<mapping-file>jbpm.task.hbm.xml</mapping-file>
<!-- <mapping-file>jbpm.identity.hbm.xml</mapping-file>-->
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
         <property name="hibernate.hbm2ddl.auto" value="validate"/>
         <property name="hibernate.show_sql" value="false"/>
         <property name="hibernate.format_sql" value="true"/>
         <property name="jboss.entity.manager.factory.jndi.name" value="java:/prodagioAPEntityManagerFactory"/>
         <property name="hibernate.search.default.indexBase" value="/prodagio_indexs"/>
<property name="hibernate.ejb.event.post-insert" value="org.hibernate.search.event.FullTextIndexEventListener"/>
<property name="hibernate.ejb.event.post-update" value="org.hibernate.search.event.FullTextIndexEventListener"/>
<property name="hibernate.ejb.event.post-delete" value="org.hibernate.search.event.FullTextIndexEventListener"/>
      </properties>
 
      
   </persistence-unit>

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

Reply to this message by going to Community
[http://community.jboss.org/message/544511#544511]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100524/260f3de1/attachment.html 


More information about the jboss-user mailing list