java - neo4j transaction not rolling back -
i using neo4j 2.1.7 java.
try(transaction transaction = this.graphdatabaseservice.begintx()) { node user = this.graphdatabaseservice.createnode(); user.setproperty("userid", userid); transaction.failure(); }
so getting object of graphdatabaseservice , creating new transaction , marking rollback. according javadocs:
void failure()
marks transaction failed, means unconditionally rolled when close() called. once method has been invoked, doesn't matter if success() invoked afterwards -- transaction still rolled back.
but see node gets created no matter what. tried throwing exception
. tried not calling transaction.success()
@ all. still see changes committed , not rolled back. not sure of behaviour , explanation. thanks.
if must know, trying build commit() function nested transactions such if operation fail within inner transactions, parent transaction must fail too. however, in process found no matter do, transactions getting committed.
update 1:
the embedded version of neo4j works fine. rest version causing trouble. using package rest:
<dependency> <groupid>org.neo4j</groupid> <artifactid>neo4j-rest-graphdb</artifactid> <version>2.0.1</version> </dependency>
no transactions on rest, @ least not old version.
there transactions on http new cypher endpoint.
that library discontinued, recommend use e.g. jdbc driver or new implementation comes spring data rest.
Comments
Post a Comment