2

spring-data と neo4j に取り組んでいますが、トランザクションで問題が発生しました。

これが私の春の構成です:

<context:spring-configured/>
<context:annotation-config/>

<context:component-scan base-package="fr.simple.nosqltest" />

<neo4j:repositories base-package="fr.simple.nosqltest"/>

<!-- Neo4j configuration (creates Neo4jTemplate) -->
<neo4j:config graphDatabaseService="graphDatabaseService" />


<!-- For unit tests : 
With these two following lines (uncomment them to test), datas are well recorded   in directory database
and rollback on failed transaction works -->
<!--    <neo4j:config storeDirectory="target/neo4j-db"/>  -->
<!--     <tx:annotation-driven mode="proxy"/> -->

<!--    But in a real world, I would like to use a Neo4J server. -->
<!--    Rollbacks are not working with this following configuration :  -->
<bean id="graphDatabaseService"
    class="org.springframework.data.neo4j.rest.SpringRestGraphDatabase">
    <constructor-arg value="http://localhost:7474/db/data/" />
</bean>
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>

Spring 構成ファイルのコメントで述べたように、次のユニット テストを実行している場合、トランザクションは正常に機能します。

neo4j:config storeDirectory="target/neo4j-db"

同じコードを実行しようとしたときではありませんが、実際のneo4jサーバーを使用しています。タグの書き方についていろいろ試してみましたが、うまくいきtx:annotation-drivenません。インターネットで解決策を見つけることができませんが、見つけたすべての例は、neo4j サーバーなしで動作します。

このフレームワークでトランザクションを構成するのを手伝ってくれませんか。コードを github に投稿しました: https://github.com/clement94/spring-neo4j-test

4

0 に答える 0