-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How do I get entities which contain ALL values
PostPosted: Sat Oct 16, 2010 5:32 pm 
Newbie

Joined: Sat Oct 16, 2010 5:20 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.