title: JPA 2 Criteria API: filtering on a specific field in collections without static Metamodel
body: <p>I have a JPA datamodel as following(a simplified version) and I would like to get demands having events between some given dates. </p>
  
  <pre><code>public class Demand {
   private Set&lt;Event&gt; events;
  }
  
  public class Event {
   private Date date;
  }
  </code></pre>
  
  <p>I do get a Path reference to events attribute but I don't know how to express a between predicate based on the date attribute.</p>
  
  <pre><code>Path&lt;Set&lt;Evenement&gt;&gt; pathEvents = demand.&lt;Set&lt;Evenement&gt;&gt; get("events");
  pathEvents.get("date") 
  </code></pre>
  
  <p>throw "org.springframework.dao.InvalidDataAccessApiUsageException: Illegal attempt to dereference path source" exception.
  Thanks for your help !</p>