i am trying to write an entity to database with camel jpa component. The
problem is that i get

    javax.persistence.TransactionRequiredException: no transaction is in
progress
        at
org.hibernate.internal.SessionImpl.checkTransactionNeeded(SessionImpl.java:3428)
        at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1395)
        at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1391)
        at
org.apache.camel.component.jpa.JpaProducer$1.doInTransaction(JpaProducer.java:85)

The persistent unit is parsed fin and the table is created. Here ist
persistence.xml:



I created a test to write one entity:


 


Since there is no real way to start and end a transaction in camel semantic
i think the problem is related to setup?

I also tried to add ``.transacted()`` to the route. This yields ``No bean
could be found in the registry of type: PlatformTransactionManager``
Then i added this line to setup method:



and this again yields ``javax.persistence.TransactionRequiredException: no
transaction is in progress``.

i am not sure what to configure on JpaComponent and what to bind into the
registry.

I also debugged a bit. I checked the fields in JpaProducer where
``entityManager.flush()`` is throwing the exception:
trasactionTemplate is set "PRPAGATION_REQUIRED,ISOLATION_DEFAULT" with
correct JpaTransactionManager.

So how to get JPA-component working?

(my code is based on this:
http://www.mastertheintegration.com/camel/camel-and-database/camel-route-to-jpa.html
and i also posted the question here:
http://stackoverflow.com/questions/39572776/camel-jpa-no-transaction-is-in-progress)



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jpa-no-transaction-is-in-progress-tp5787740.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to