【发布时间】:2014-02-24 01:52:27
【问题描述】:
我有一个如下所示的用户节点类:
@NodeEntity
public class User {
@GraphId
Long nodeId;
@Indexed(unique = true,indexName="uid")
Long uid;
String name;
@RelatedTo(type="FRIENDS", direction=Direction.BOTH)
Set<User> friends;
@RelatedToVia(type="FRIENDS", elementClass=IsFriends.class)
Set<IsFriends> friendRelationships;
@RelatedTo(type="LIKES", direction=Direction.OUTGOING)
Set<Article> article;
@RelatedToVia(type="LIKES", elementClass=Reco.class)
Set<Likes> likeRelationships;
//getters and setters
..
..
}
在我的控制器类中,我注入了这样的 repo:
@Inject
private UserRepository userRepo;
我正在尝试使用以下内容检索用户对象:
User user = userRepo.findByPropertyValue("uid", userId);
我的图表中有 2 个用户,上面的对象检索对一个有效,但对另一个无效。如果我运行密码查询,我会看到两个节点。
这两个节点都是使用 Spring Data Neo4j 创建的。
感谢任何帮助。谢谢..
【问题讨论】:
标签: neo4j spring-data spring-data-neo4j