爲Trying out neo4j grails plugin, but it does not mach the docs找不到節點
延續我有一個測試,現在看起來是這樣的:
package com.iibs.graph
import groovy.util.GroovyTestCase
import com.iibs.graph.Node
public class NodeTests extends GroovyTestCase {
def graphDatabaseService
void testCRUD() {
Node.deleteAll(Node.list())
Node node = new Node(name: "Name")
node.save(flush: true, failOnError: true)
Node found = Node.findByName("Name")
assert found instanceof Node
assert found.getName() == "Name"
org.neo4j.graphdb.Node graphNode = graphDatabaseService.getNodeById(node.getId())
assert graphNode.instanceOf(org.neo4j.graphdb.Node) == true
}
}
而且我如下得到一個錯誤:
| Running 1 integration test... 1 of 1
| Failure: testCRUD(com.iibs.graph.NodeTests)
| org.neo4j.graphdb.NotFoundException: Node 905482810884096 not found
at org.neo4j.kernel.InternalAbstractGraphDatabase.getNodeById(InternalAbstractGraphDatabase.java:1088)
at com.iibs.graph.NodeTests.testCRUD(NodeTests.groovy:22)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
| Completed 1 integration test, 1 failed in 0m 2s
據我所知,從提到的線程,這應該是獲得節點的可能方式之一。或者我錯了?
我不熟悉Grails的界面,但寫入操作如創建一個新的節點經常需要交易,你沒有一個。也許包含您正在編寫的節點的事務在您嘗試查找該節點之前未提交? – FrobberOfBits