title: Joins to Embeddable classes in JPA2.1 specification - ContactInfo - The collection-valued path must resolve to an association field
body: <p>I am trying to learn Java Persistance API. So it is written on page174 of JPA 2.1 specification :</p>
  
  <p>In the following example, contactInfo denotes an embeddable class consisting of an address and
  set of phones. Phone is an entity. </p>
  
  <pre><code>SELECT p.vendor FROM Employee e JOIN e.contactInfo.phones p
  WHERE e.contactInfo.address.zipcode = '95054' 
  </code></pre>
  
  <p>The following query is equivalent to the query above:</p>
  
  <pre><code>SELECT p.vendor FROM Employee e JOIN e.contactInfo c JOIN c.phones p WHERE e.contactInfo.address.zipcode = '95054'
  </code></pre>
  
  <p>then on page 176:
  The query below joins over Employee, ContactInfo and Phone. ContactInfo is an embeddable class that consists of an address and set of phones. Phone is an entity.</p>
  
  <pre><code>SELECT p.vendor FROM Employee e JOIN e.contactInfo c JOIN c.phones p WHERE c.address.zipcode = '95054'
  </code></pre>
  
  <p>So when I try to execute such queries only the first works. The last two queries cause error:
  Exception in thread "main" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
  Exception Description: Problem compiling [SELECT p.vendor FROM Employee e JOIN e.contactInfo c JOIN c.phoneNumbers p WHERE c.address.zipcode = 'zip2']. 
  [37, 50] 
  <strong>The collection-valued path 'e.contactInfo' must resolve to an association field.</strong></p>
  
  <p>Could anyone explain why is that? I also tried to reproduce other examples of joins to embeddable classes from the specification, but always got the same error.</p>
  
  <p>Thank you
  Best regards</p>