I'm having problems executing a search on my domain model. I have 3 entities Person, Event and PartnerOfEvent. They are mapped like this:
Code:
@Indexed
public class Person {
private String name;
@OneToMany(mappedBy = "partner", cascade = CascadeType.ALL)
private Set<PartnerOfEvent> partnerOfEvents;
}
public class PartnerOfEvent {
@ManyToOne
@JoinColumn(name = "Partner_Id")
protected Person partner;
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "Event_Id", nullable = false)
protected Event event;
}
public class Event {
@OneToMany(mappedBy = "event")
protected Set<PartnerOfEvent> partnersOf;
}
I want to store all this information in the index. Then I want to be able to write a search query that retrieves a Person by its partners name. That would translate into something like partnerOfEvents.event.partnersOf.partner.name:John. But I cannot map my classes so that a query like this is supported. Can map my classes in order to write a query like this? Is there a way to retrieve a person by its partner's names given my domain model?