Spring数据neo4j:通过EndNode ID进行计数关系 [英] Spring data neo4j : count relation By EndNode ID

查看:217
本文介绍了Spring数据neo4j:通过EndNode ID进行计数关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用spring数据neo4j 5.0.0.

I'm using a spring data neo4j 5.0.0.

我的模型是(user)-[:ATTEND]-(meeting)ATTEND是RelationshipEntity.
用户有出席关系,会议没有关系.

My model is a (user)-[:ATTEND]-(meeting) and ATTEND is a RelationshipEntity.
user have attend relationship, meeting does not have relationship.

@Relationship(type = "ATTEND")
Set<AttendMeeting> attendMeetings = new HashSet<>();

RelationshipEntity代码.

RelationshipEntity code.

@Setter @Getter @ToString
@NoArgsConstructor
@RelationshipEntity(type = "ATTEND")
public class AttendMeeting {
    @GraphId private Long id;
    @JsonIgnore
    @StartNode private User user;
    @EndNode private Meeting meeting;
}

所以我只是想参加根据MeetingId进行的计数.

So I just wannna attend count by meetingId.

是否可以不使用查询?

当我在repository.countByMeetingId方法上运行时 自动创建查询为

when I run on repository.countByMeetingId method auto creation query is

MATCH (m:`Meeting`) WHERE m.`id` = { `meeting_id_0` } MATCH (n)-[r0:`ATTEND`]->(m) RETURN COUNT(r0)

我希望id(m),但生成的查询是m.`id'.

I expect id(m) but generated query is m.`id'.

我可以设置countByRelationShipEntityId吗?
如何自动生成这样的代码.
MATCH ()-[r:ATTEND]-(m:Meeting) WHERE ID(m) = {0} RETURN COUNT (r)

Can I make countByRelationShipEntityId?
How can I auto generate code like this.
MATCH ()-[r:ATTEND]-(m:Meeting) WHERE ID(m) = {0} RETURN COUNT (r)

感谢您的答复,对不起我的英语不好.

Thanks for your answer and sorry for my poor English.

推荐答案

当前(SDN 5.0.1)不可能依靠给定的对象,例如countByMeeting(Meeting meeting)或让SDN将id作为特殊属性进行处理. 请随时在 https://jira.spring.io/browse/DATAGRAPH/<上创建问题/a>

There is currently (SDN 5.0.1) no possibility to count on a given object e.g. countByMeeting(Meeting meeting) or let SDN handle id as a special property. Please feel free to create an issue at https://jira.spring.io/browse/DATAGRAPH/

我们目前唯一不提供查询的解决方案是按相关对象属性(例如countByMeetingName(String meetingName)

The only solution we can offer at the moment without providing a query is a count by related object property like countByMeetingName(String meetingName)

问题已创建 https://jira.spring.io/browse/DATAGRAPH-1049

这篇关于Spring数据neo4j:通过EndNode ID进行计数关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆