Can .hbm files be used in a JPA application with Hibernate as a JPA provider?

I would like to replace my own BPM implementation with Activiti or jBPM-5 in a product that uses Hibernate (No JPA) with Spring to implement a persistent level. Unfortunately, both Activiti and jBPM5 require JPA (according to their documentation), and it is not possible to transfer the entire existing Hibernate implementation to JPA in the product.

  • Is there a way to configure JPA 2.0 (the JPA provider is Hibernate) with Spring 3 without migrating the Hibernate implementation to JPA (i.e. save .hbm files)?

Note. I know that the application will not comply with the JPA, and another JPA provider cannot be used.

  • If there is a way, suppose the Spring JTA Transaction Manager is configured with the correct settings. Can application logic and BPM workflow logic run in the same Spring transaction?
+6
spring hibernate transactions jbpm
source share
2 answers

For transactions, see Activiti Spring Transaction Documents. If you cannot port the application to using JPA, another option is to layer the facade above your Hibernate domain. Activiti allows you to call methods on Spring beans, so you can create a facade or use an existing level of service. Take a look at sample applications shipped with Activity to see how Spring Integration works.

+1
source share

jBPM w / JPA can be integrated with older non-JPA applications using Spring. Interactions with jBPM use JPA, but your application will use sleep mode. The only drawback is that you have to deal with two different transactions, but any problems can be mostly fixed.

enter image description here

  • First run the Hibernate transaction and execute any business logic you want

  • Start the JBPM transaction by calling the JBPM API to start the process or dispatch the event, etc.

  • Any WorkItemHandler implementations must join an external transaction using factory APIs.

  • Hibernate flush () must be called at the end of each execution of the WorkItemHandler to raise most of the exceptions thrown by the business code.

  • WorkItemHandler must catch any exception generated by the business code and reconstruct it so that the JBPM transaction also fails.

0
source share

All Articles