Kundera + Neo4j + Guice (guice-persist)

44 views
Skip to first unread message

Bo Ferri

unread,
Jan 13, 2015, 7:06:30 AM1/13/15
to kundera...@googlegroups.com
Hi all,,

I'm evaluating Kundera right now for a possible switch of our persistence provider of our JPA-based application. I got so far that I'm struggling with transaction support right now. We also make use of Guice in our application and therefore we utilise the guice-persist extension that takes care of EntityManager all over our application. To make an operation transactional we utilise the @Transactional annotation from guice-persist that (should) ensures that this operation will be execution in transactional environment. Unfortunately, after the switch to Kundera (2.15) + Neo4j, I'm getting now the following exception:

org.neo4j.graphdb.NotInTransactionException: All Modifying Neo4J operations must be executed within a transaction
    at com.impetus.client.neo4j.Neo4JClient.checkActiveTransaction(Neo4JClient.java:807)
    at com.impetus.client.neo4j.Neo4JClient.onPersist(Neo4JClient.java:280)
    at com.impetus.kundera.client.ClientBase.persist(ClientBase.java:105)
    at com.impetus.kundera.lifecycle.states.ManagedState.handleFlush(ManagedState.java:197)
    at com.impetus.kundera.graph.Node.flush(Node.java:531)
    at com.impetus.kundera.persistence.DefaultTransactionResource.onFlush(DefaultTransactionResource.java:88)
    at com.impetus.kundera.persistence.DefaultTransactionResource.onCommit(DefaultTransactionResource.java:72)
    at com.impetus.kundera.persistence.Coordinator.coordinate(Coordinator.java:79)
    at com.impetus.kundera.persistence.KunderaEntityTransaction.onTransaction(KunderaEntityTransaction.java:128)
    at com.impetus.kundera.persistence.KunderaEntityTransaction.commit(KunderaEntityTransaction.java:78)
    at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:87)
    at our DAO service

My conclusion is that the @Transactional annotation from guice-persist is ignored at the moment of execution and the operation is executed non-transactional. So did you ever try Kundera with guice-persist (successfully) so far? (I've only seen an example that makes use of Guice, but not guice-persist extension)

Thanks a lot in advance for all your help.

Cheers,


Bo

Vivek Mishra

unread,
Jan 13, 2015, 7:27:36 AM1/13/15
to kundera...@googlegroups.com
The way JTA/JPA transaction works with Kundera is as follows:

1. For JTA, transaction-type should be defined as JTA and currently it is supported and tested over Tomcat with in-container transaction support. All Kundera need is, java:comp/UserTransaction binding.

2. For JPA transactions rather out of container transactions, you need to explicitly manage transaction boundary.

Specific annotation @Transactional {spring or guice-persist} are implicitly handled by these APIs, hope i am getting you correct at this point?

-Vivek

--
You received this message because you are subscribed to the Google Groups "kundera-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kundera-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bo Ferri

unread,
Jan 13, 2015, 7:35:28 AM1/13/15
to kundera...@googlegroups.com
Hi Vivek,

ok, I can try to replace the @Transactional annotation with direct transaction implementation (i.e. em.begin() etc.).

Cheers,


Bo

Vivek Mishra

unread,
Jan 13, 2015, 7:37:09 AM1/13/15
to kundera...@googlegroups.com
Just to add, there is some critical work kundera team planning to work around transaction support.

-Vivek
Reply all
Reply to author
Forward
0 new messages