Announcement Announcement Module
Collapse
No announcement yet.
Persistent state of a relationship after transaction rollback Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Persistent state of a relationship after transaction rollback

    I think this may be related to this bug, but for relationships rather than nodes. Alternatively, I might be doing something stupid.

    If I make a new relationship, persist it, but roll back the transaction, the relationship still has persistent state. If I then try and persist it again, I get the exception "org.neo4j.graphdb.NotFoundException: Relationship[1] not found."

    Clone https://github.com/MattBlissett/spri...lationship-bug for an example.

    Selected lines from a log:
    Code:
    17:58:04.867 INFO  matt.app.App - →→→ Dumping repository (before)
    17:58:04.880 WARN  matt.graphrepo.NameService - ▻►► SHOWING GRAPH ◄◄◅
    17:58:05.470 WARN  matt.graphrepo.NameService - (1 a)
    17:58:05.473 WARN  matt.graphrepo.NameService - (2 b)►b↗a (Matt)►(1 a)
    17:58:05.474 WARN  matt.graphrepo.NameService - (3 c)
    17:58:05.474 WARN  matt.graphrepo.NameService - ▻►► END OF GRAPH ◄◄◅
    ...
    17:58:05.474 INFO  matt.app.App - →→→ Performing transactional change (with rollback)
    17:58:05.477 INFO  matt.app.App - C→A's entity state or[email protected]24c4
    17:58:05.477 INFO  matt.app.App - C→A's persistent state null
    17:58:05.477 INFO  matt.app.App - C→A's has persistent state false
    ...
    17:58:05.481 DEBUG o.s.t.jta.JtaTransactionManager - Transactional code has requested rollback
    ...
    17:58:05.482 ERROR matt.app.App - C→A has persistent state, but wasn't persisted.
    17:58:05.482 INFO  matt.app.App - C→A's entity state [email protected]a224c4
    17:58:05.482 INFO  matt.app.App - C→A's persistent state Relationship[1]
    17:58:05.482 INFO  matt.app.App - C→A's has persistent state true
    ...
    17:58:05.619 INFO  matt.app.App - →→→ Performing transactional change (successfully)
    17:58:05.621 TRACE o.s.t.a.AnnotationTransactionAspect - Completing transaction for [matt.graphrepo.NameService.addNewRelationships] after exception: org.neo4j.graphdb.NotFoundException: Relationship[1] not found.
    ...
    17:58:05.627 DEBUG o.s.t.support.TransactionTemplate - Initiating transaction rollback on application exception
    org.neo4j.graphdb.NotFoundException: Relationship[1] not found.
            at org.neo4j.kernel.impl.core.NodeManager.getRelationshipForProxy(NodeManager.java:561) ~[neo4j-kernel-1.8.1.jar:1.8.1]
            at org.neo4j.kernel.InternalAbstractGraphDatabase$3.lookupRelationship(InternalAbstractGraphDatabase.java:633) ~[neo4j-kernel-1.8.1.jar:1.8.1]
            at org.neo4j.kernel.impl.core.RelationshipProxy.setProperty(RelationshipProxy.java:129) ~[neo4j-kernel-1.8.1.jar:1.8.1]
            at org.springframework.data.neo4j.fieldaccess.PropertyFieldAccessorFactory$PropertyFieldAccessor.setValue(PropertyFieldAccessorFactory.java:73) ~[spring-data-neo4j-2.2.0.RELEASE.jar:na]
            at org.springframework.data.neo4j.fieldaccess.DefaultEntityState.setValue(DefaultEntityState.java:113) ~[spring-data-neo4j-2.2.0.RELEASE.jar:na]
            at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.setValue(DetachedEntityState.java:158) ~[spring-data-neo4j-2.2.0.RELEASE.jar:na]
            at org.springframework.data.neo4j.fieldaccess.DetachedEntityState.setValue(DetachedEntityState.java:137) ~[spring-data-neo4j-2.2.0.RELEASE.jar:na]
            at matt.graph.SimpleChildOf.flag_aroundBody17$advice(SimpleChildOf.java:176) ~[classes/:na]
            at matt.graph.SimpleChildOf.setFlag(SimpleChildOf.java:46) ~[classes/:na]
            at matt.graphrepo.NameService.addNewRelationships(NameService.java:52) ~[classes/:na]
            at matt.app.TestController$1.doInTransactionWithoutResult(TestController.java:42) ~[classes/:na]
            at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33) ~[spring-tx-3.2.1.RELEASE.jar:3.2.1.RELEASE]
            at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131) ~[spring-tx-3.2.1.RELEASE.jar:3.2.1.RELEASE]
            at matt.app.TestController.change(TestController.java:37) [classes/:na]
            at matt.app.App.main(App.java:91) [classes/:na]
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_09]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_09]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_09]
            at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_09]
            at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297) [exec-maven-plugin-1.2.1.jar:na]
            at java.lang.Thread.run(Thread.java:722) [na:1.7.0_09]
Working...
X