我是springbootneo4j的新手。我在进行通用查询时遇到困难。我希望能够进行任何类型的查询并获得没有域实体的结果。
我正在存储库类中进行如下查询:
@Query("MATCH (p:Employee) RETURN ID(p) as id, p.name as name, p.salary as salary ")
那不起作用,但是以下查询正在起作用:
@Query("MATCH (p:Employee) RETURN p ")
我的域实体类是这样的:
@NodeEntity
public class Employee {
@Id
@GeneratedValue
private Long id;
private String name;
private int salary;
@Relationship(type = "IS_BOSSOF", direction = Relationship.UNDIRECTED) Set<Employee> reporties = new HashSet<>();
public Employee() {}
// some more code
}
创建命令是这样的:
(laksmi:Employee{name:"Laksmi",salary:200}),(ashwini:Employee{name:"AshwiniV",salary:300}), (harish:Employee{name:"Harish",salary:400}), (jay)-[:IS_BOSSOF]->(mukesh), (xyz)-[:IS_BOSSOF]->(mukesh), (harish)-[:IS_BOSSOF]->(ashwini),