neo4j - How to use exists, findOne and other GraphRepository methods, taking id as argument? -
let assume following:
1). have 2 entities:
@nodeentity public class { @graphid private long id; ... } @nodeentity public class b { @graphid private long id; ... }
2). have 2 appropriate repositories:
public interface arepository extends graphrepository<a> { ... } public interface brepository extends graphrepository<b> { ... }
3). , have following nodes in database:
- a id=1
- b id=2
case a: assume need check whether id=2 exists:
arepository.exists(2)
i expect return false
, since id=2 isn't exists. returns true
, since tries find among ids, not among nodes.
case b: or maybe need find b id=1:
brepository.findone(1);
i expect returns null
or throws appropriate exception, informing b id=1 isn't exists. throws unexpected me persistententityconversionexception
.
hence questions:
- how can use aforementioned operations expected behavior?
- may there workaround?
Comments
Post a Comment