Java Neo4j删除和内部500个错误
当我在这样的测试之后删除我的neo4j数据库时Java Neo4j删除和内部500个错误,java,neo4j,Java,Neo4j,当我在这样的测试之后删除我的neo4j数据库时 public static final DatabaseOperation clearDatabaseOperation = new DatabaseOperation() { @Override public void performOperation(GraphDatabaseService db) { //This is deprecated on the GraphDatabaseService interfa
public static final DatabaseOperation clearDatabaseOperation = new DatabaseOperation() {
@Override public void performOperation(GraphDatabaseService db) {
//This is deprecated on the GraphDatabaseService interface,
// but the alternative is not supported by implementation (RestGraphDatabase)
for (Node node : db.getAllNodes()) {
for (Relationship relationship : node.getRelationships()) {
relationship.delete();
}
boolean notTheRootNode = node.getId() != 0;
if (notTheRootNode) {
node.delete();
}
}
start r=relationship(*) delete r;
start n=node(*) delete n;
通过ajax搜索查询数据库时(即搜索空数据库时,返回内部错误)
但是,如果我像这样手动删除数据库
public static final DatabaseOperation clearDatabaseOperation = new DatabaseOperation() {
@Override public void performOperation(GraphDatabaseService db) {
//This is deprecated on the GraphDatabaseService interface,
// but the alternative is not supported by implementation (RestGraphDatabase)
for (Node node : db.getAllNodes()) {
for (Relationship relationship : node.getRelationships()) {
relationship.delete();
}
boolean notTheRootNode = node.getId() != 0;
if (notTheRootNode) {
node.delete();
}
}
start r=relationship(*) delete r;
start n=node(*) delete n;
没有抛出异常
这很可能是调用和返回中较低级别的代码出现问题
只是想知道为什么错误只在上面的一种情况下有效,而不是在两种情况下都使用cypher
您可能应该更清楚地说明您使用的是rest图形数据库
您是在删除之后还是在删除期间进行查询
请检查data/graph.db/messages.log和data/log/console.log中的日志,以查找错误原因
也许您还可以根据您的错误查看http-500请求的响应体,我猜您的数据在删除后会损坏
我使用了与您相同的代码并删除了节点,只是我将迭代器放入事务中,并在操作后关闭了数据库
e、 g
希望它对你有用