title: HQL Query SELECT with NOT IN
body: <p>I need a HQL Query but I just dont get it.</p>
  
  <pre><code>SELECT * FROM Poll WHERE pid NOT IN (
  SELECT pid FROM votes WHERE uid =  'theuserid')
  </code></pre>
  
  <p>I want all List of Poll´s back where the uid <strong>not in</strong> the table votes exists.</p>
  
  <p>Also helpfull would be the hql query where the uid <strong>in</strong> the table votes exists, but I guess this is very similar ;-)</p>
  
  <p>These are the 2 classes:</p>
  
  <pre><code>public class Poll {
  
  private int pid;
  private String name;
  private String description;
  private Date deadline;
  private Set&lt;Team&gt; teams = new HashSet&lt;Team&gt;(0);
  //some getter &amp; setter
  }
  
  public class Vote {
  
  private int vid;
  private String uid;
  private int pid;
  private int tid;
  private int votes;
  //some getter &amp; setter
  }
  </code></pre>
  
  <p>Can smbdy please help me. I guess it is a join with a WHERE and NOT LIKE but I just dont get it.</p>
  
  <p>Merci!</p>
  
  <p>This is btw the hibernate mapping:</p>
  
  <pre><code> &lt;hibernate-mapping&gt;
   &lt;class name="package.model.Poll" table="poll"&gt;
   &lt;id name="pid" column="pid" &gt;
   &lt;generator class="increment"/&gt;
   &lt;/id&gt;
  &lt;property name="name" column="name" /&gt;
  &lt;property name="description" column="description" /&gt;
  &lt;property name="deadline" type="timestamp" column="deadline" /&gt;
  
  &lt;set name="teams" table="pollchoice" 
          inverse="false" lazy="false" fetch="select" cascade="all" &gt;
          &lt;key&gt;
              &lt;column name="pid" not-null="true" /&gt;
          &lt;/key&gt;
          &lt;many-to-many entity-name="knt.exceedvote.model.Team"&gt;
              &lt;column name="tid" not-null="true" /&gt;
          &lt;/many-to-many&gt; 
  &lt;/set&gt;
   &lt;/class&gt;
   &lt;/hibernate-mapping&gt; 
  
   &lt;hibernate-mapping&gt;
     &lt;class name="package.model.Vote" table="votes"&gt;
      &lt;id name="vid" column="vid" &gt;
      &lt;generator class="increment"/&gt;
     &lt;/id&gt;
  &lt;property name="pid" column="pid" /&gt;
  &lt;property name="uid" column="uid" /&gt;
  &lt;property name="tid" column="tid" /&gt;
  &lt;property name="votes" column="votes" /&gt;
  
  
    &lt;/class&gt;
   &lt;/hibernate-mapping&gt;
  </code></pre>