title: Hibernate Criteria select using embedded object (tuple)
body: <p>In my case I have a SQL query which looks like:</p>
  
  <pre><code>select * from event_instance where (object_id, object_type) in 
      (&lt;LIST OF TUPLES RETRIEVED FROM SUBQUERY&gt;);
  </code></pre>
  
  <p>I want to map this on Hibernate Entities and I have a problem with this query. My mapping looks like that:</p>
  
  <pre><code>     @Entity
       @Table(name="event_instance")
       public class AuditEvent {
           &lt;OTHER_FIELDS&gt;
  
           @Column( name = "object_type", nullable = false)
           private String objectType;
  
           @Column( name ="object_id" , nullable = false)
           private Integer objectId;
       }
  </code></pre>
  
  <p>and second entity:</p>
  
  <pre><code>    @Entity
      @Table(schema = "els" ,name = "acg_objects")
      public class AcgObject implements Serializable{
  
          @Id
          @Column(name = "acg_id")
          private String acgId;
  
          @Id
          @Column(name="object_type")
          private String objectType;
  
          @Id
          @Column(name="object_id")
          private Integer objectId;
  
          &lt;OTHER FIELDS&gt;
  
  }
  </code></pre>
  
  <p>I already run query for getting AcgObjects and for my DAO I'm getting List only thing I want to do is query a touple using criteria like:</p>
  
  <pre><code>      crit.add(Restrictions.in("objectType,objectId",&lt;List of tuples&gt;);
  </code></pre>
  
  <p>Is it possible? I was trying to use @Embedded object but don't know how exactly construct a query for it. Please help</p>