Hi! I have the following entities:
Code:
@Entity
public class ContactEntity
{
...
private Collection<EventInstanceEntity> eventInstances;
@JoinTable(name = "contact_event", catalog = "kbc", joinColumns = @JoinColumn(name = "contact_id"), inverseJoinColumns = @JoinColumn(name = "event_id"))
@ManyToMany
public Collection<EventInstanceEntity> getEventInstances()
{
return eventInstances;
}
public void setEventInstances(Collection<EventInstanceEntity> eventInstances)
{
this.eventInstances = eventInstances;
}
...
}
Code:
@Entity
public class EventInstanceEntity
{
...
private int eventId;
@Column(name = "event_id")
@Basic
public int getEventId()
{
return eventId;
}
public void setEventId(int eventId)
{
this.eventId = eventId;
}
...
I need to get all the contacts that have attended a given selection of events. For example, all contacts that have attended events 1, 4
and 6. Using an
in restriction in a Criteria would not work, since that would bring all contacts that have attended events 1, 4
or 6.
Any ideas?
Thanks in advance for your help!
MatÃas