-
1. Re: JPBM persistence and transaction Questions
salaboy21 Dec 3, 2012 11:44 AM (in response to artist123)1 of 1 people found this helpfulI'm not sure to understand "your understanding".. you will need to elaborate more..
About your questions:
1) No you can have just one Persistence Unit and use the Local Task Service
2) If you use just one Persistence Unit you don't need to care about that.. JTA or Resource Local are for cordinating more than one Transactional Resourece inside the same transaction
3) Yes
4) no, it's up to you, you can use just a single schema..
Cheers
-
2. Re: JPBM persistence and transaction Questions
artist123 Dec 3, 2012 11:54 AM (in response to salaboy21)Thanks Mauricio Salantino,
What my understanding is ...
a humantask defined inside the process, human task node is one of the node in the process flow, So every humantask belongs to one or more process flow. so the relatiship between human task and the process defined using the process id and task id. So when we store the process information in the database we can store the task information also in the same databse. So my final comment is all can handle in on epersintence unit using one schema. but the example and some jbpm documents shows diffirent two persistence unit and two schemas (like jbpm5 and task).
thanks,
-
3. Re: JPBM persistence and transaction Questions
salaboy21 Dec 3, 2012 12:06 PM (in response to artist123)1 of 1 people found this helpfulYes you can, just use a single persistence.xml with a single persistence unit.. make sure that you use that name to create the session and the local task service instance.
And everything will be stored in the same schema. Cheers
-
4. Re: JPBM persistence and transaction Questions
artist123 Dec 3, 2012 1:21 PM (in response to salaboy21)Just want to know more about why do you insist local task service when we use single persistence unit?
-
5. Re: JPBM persistence and transaction Questions
salaboy21 Dec 3, 2012 1:29 PM (in response to artist123)Just in the same way, you only need to create a single persisntece unit and use that for both.. session and local human task service.
Here is an example: https://github.com/Salaboy/jBPM5-Developer-Guide/blob/master/chapter_08/jBPM5-PersistentProcess/src/test/java/com/salaboy/jbpm5/PersistentProcessTest.java#L375
Try it and let us know if you have some troubles.
Cheers
-
6. Re: JPBM persistence and transaction Questions
artist123 Dec 4, 2012 4:39 PM (in response to salaboy21)Yes, It is working fine while using single persistence unit with LocalHT, what happen if I want to use mina or hornetq. Is still applicable using single persistence unit? I tried HT server starts good, but process fails...while creating the knowledgesession from jpaknowlege service, the environment breaks bcos of btm transactionservice
(i am using com.mysql.jdbc.jdbc2.optional.MysqlXADataSource not btm)
I got the following error...
javax.persistence.PersistenceException: [PersistenceUnit: org.jbpm.runtime.ht] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
at com.salaboy.jbpm5.ProcessTest.createKnowledgeSession(ProcessTest.java:102)
at com.salaboy.jbpm5.ProcessTest.main(ProcessTest.java:59)
Caused by: org.hibernate.HibernateException: Could not obtain BTM transaction manager instance
at org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:50)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:367)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 5 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.hibernate.transaction.BTMTransactionManagerLookup.getTransactionManager(BTMTransactionManagerLookup.java:47)
... 9 more
Caused by: bitronix.tm.utils.InitializationException: cannot open disk journal
at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:75)
at bitronix.tm.TransactionManagerServices.getTransactionManager(TransactionManagerServices.java:62)
... 14 more
Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file.
at java.io.FileDescriptor.read(Native Method)
at java.io.FileDescriptor.read(FileDescriptor.java:77)
at java.io.RandomAccessFile.read(RandomAccessFile.java:308)
at java.io.RandomAccessFile.readInt(RandomAccessFile.java:762)
at bitronix.tm.journal.TransactionLogHeader.<init>(TransactionLogHeader.java:96)
at bitronix.tm.journal.TransactionLogAppender.<init>(TransactionLogAppender.java:69)
at bitronix.tm.journal.DiskJournal.open(DiskJournal.java:151)
at bitronix.tm.BitronixTransactionManager.<init>(BitronixTransactionManager.java:62)
... 15 more