cancel
Showing results for 
Search instead for 
Did you mean: 

Spring data jpa + activiti error!!

kinorsi
Champ in-the-making
Champ in-the-making
My project is using Spring Data Jpa + Activiti + Hibernate。
But the app can't start. The database connection will always closed!
Does anyone have a demo using Spring data jpa with activiti?
17 REPLIES 17

shardt
Champ in-the-making
Champ in-the-making
Hallo,
I had the same problem while using activiti and hibernat with the same datasource. With hibernate 4.1.9.Final it worked, with 4.2.6.Final not anymore.
Now I tracked it down to be the setting of the jpaVendorAdapter and/or the jpaDialect in the entityManagerFactory. I removed both properties from the spring config:

<bean id="entityManagerFactory"
            class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <!–
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
    </property>
    <property name="jpaDialect">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
    </property>
    –>

than it worked again with hibernate 4.2.6.Final.

according to this:
http://stackoverflow.com/questions/9684197/why-did-i-need-to-define-a-hibernate-jpa-vendor-adapter-i...

it is enough to define the
<provider>org.hibernate.ejb.HibernatePersistence</provider> in the persistence.xml

I could provide a simple test project to demonstrate this. Pleas ask.

edoardo
Champ in-the-making
Champ in-the-making
Hi ,
first of all: thanks for your post.
I've tried your suggestion and the application actually works fine  with hibernate 4.2.3 and more recent .
Unfortunately, running a process in activiti using this configuration does not guarantee transactionality anymore (activiti does not perform rollback in case of  Exception).

Have you tried to run a process in a method annotated '@Transactional' ? Does it works ?

It would be helpful to have a look at  your test project.

Thanks again.

shardt
Champ in-the-making
Champ in-the-making
Hi,
I havn't tried transactions jet with this test project. See the attached source files of my maven test project. Put it into the maven standard structure and run it with mvn clean install:
<code>
pom.xml
src\test\java\org\example\activiti\test\WorkflowServiceTest.java
src\test\resources\testProzess.bpmn
src\test\resources\logback-test.xml
src\test\resources\test-applicationContext.xml
src\test\resources\test-persistence.xml
</code>

trademak
Star Contributor
Star Contributor
Ok that means that we still need to look into this. Could you create a unit test project and add that to a JIRA?
That would speed up the time to work on this.

Thanks,

shardt
Champ in-the-making
Champ in-the-making
It is right, with my fix transactions do not work anymore.
If the hibernate transaction is rolled back, the activiti state change is written to the database.

trademak
Star Contributor
Star Contributor
Okay great, thanks for responding with a solution to this post

shardt
Champ in-the-making
Champ in-the-making

shardt
Champ in-the-making
Champ in-the-making