问题描述
我正在使用spring-data-neo4j-4.2.0.RC1和neo4j-ogm-core-2.1.0.jar
具有以下域对象
用户->角色->特权
I am using spring-data-neo4j-4.2.0.RC1 and neo4j-ogm-core-2.1.0.jar
Have the following domain objects
User -> Role -> Priviledge
public class User extends BaseEntity{
private String firstName;
private String lastName;
@Relationship(type="ROLE")
private Role role;
}
@NodeEntity
public class Role extends BaseEntity{
private String name;
@Relationship(type="PRIVILEDGE")
private Priviledge priviledge;
}
@NodeEntity
public class Priviledge extends BaseEntity {
private String name;
}
public interface UserRepository extends GraphRepository<User> {
User findByRolePriviledgeName(String name);
}
我想找到所有具有特定特权名称的用户.上面的查询适用于JPA和spring存储库,但不使用GraphRepository返回预期结果.
不确定这是错误/不受支持还是我做错了事
I want to find all users that have a specific priviledge name. The above query worked with JPA and spring repository, but does not return expected result with GraphRepository.
Not sure if this is a bug/not supported or I am doing something wrong
推荐答案
在SDN派生的查询中不支持此功能,它仅支持一个嵌套级别,而您则使用两个嵌套级别(角色,然后是特权).您可以为此编写一个自定义@Query
.
This is not supported in SDN- derived queries support only one level of nesting but yours uses two (Role, then Privilege).You can write a custom @Query
for this.
这篇关于二级关系上的GraphRepository查找方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!