密码查询和数字索引存在一些问题
@Indexed(unique = true, numeric = false)
private Long accountId;
回报:
neo4j-sh (0)$ start n=node:Principal(accountId = '1') return n;
+---------------------------------------------------------------------------------------------+
| n |
+---------------------------------------------------------------------------------------------+
| Node[41722]{__type__:"example.package.Principal",accountId:1,name:"Simple User"} |
+---------------------------------------------------------------------------------------------+
1 row
但
@Indexed(unique = true, numeric = true)
private Long accountId;
回报:
neo4j-sh (0)$ start n=node:Principal(accountId = '1') return n;
+---+
| n |
+---+
+---+
0 row
neo4j 1.9.2
弹簧数据-neo4j 2.3.0.RC1
如果我理解正确,这可能会引起这个讨论,但它已经很老了?
更新:
如果我使用
@Indexed(unique = true, numeric = false)
另一件有趣的事情发生了。检查关系是否存在(它实际上存在于数据库中):
count(r) 等于 0 - 不正确:
Long accountId = 1L;
Map<String, Object> result = template.query(
"START child=node:Principal(accountId='{childId}') " +
"MATCH child-[r:IS_MEMBER_OF]->parent " +
"RETURN count(r)", MapUtil.map("childId", accountId)).singleOrNull();
count(r) 等于 1 - 正确:
Long accountId = 1L;
Map<String, Object> result = template.query(
"START child=node:Principal(accountId='1') " +
"MATCH child-[r:IS_MEMBER_OF]->parent " +
"RETURN count(r)",null).singleOrNull();