See bellow entities.
Person Entity
@NodeEntity
public class Person {
@GraphId Long personId;
private String name;
private String surname;
@Relationship(type = "ATTENDS", direction = Relationship.OUTGOING)
private Set<Event> events;
Attends Entity
@RelationshipEntity(type = "ATTENDS")
public class Attends {
@GraphId
private Long id;
@StartNode
private Person person;
@EndNode
private Event event;
private Date attendingDate;
Event Entity
@NodeEntity
public class Event {
@GraphId
private Long eventId;
private String eventName;
@Relationship(type = "ATTENDS", direction = Relationship.INCOMING)
private Set<Person> persons;
Here is my API
/persons/{personId}/attends
I want return a list of all the object with a relationship of attending to the person with the id provided, in the example below it would be a list of events.
[{
"attends":{
"attendsId":"1234",
"startDate":"98098098",
"endDate":"098098098",
event:{ "eventId":"1234", "name":"ComicCon" }
},
"attends":{
"attendsId":"1235",
"startDate":"984548098",
"endDate":"45454545",
event:{ "eventId":"1235", "name":"AWS Summit" }
}]
I try this following query but not getting result,
List<Attends> findByPersonPersonId(Long personId);
So How can achieve this result by query ?
Please Guide, Thanks.