title: JPQL Query Bulk UPDATE SET on an ElementCollection field
body: <p>I have the following JPA Entity I want to update:</p>
  
  <pre><code>@Entity(name = "EmployeeImpl")
  @Table(name = "EmployeeImpl")
  public class EmployeeImpl {
    @Id
    @Column(name = "employeeId")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long id;
  
    @ElementCollection
    private List&lt;String&gt; phonenumber;
  }
  </code></pre>
  
  <p>I thought I use a <code>namedQuery</code> like so</p>
  
  <pre><code>@NamedQuery(name = "updateEmployee",
      query = "Update EmployeeImpl e SET e.phonenumber :number WHERE e.id = :id")
  </code></pre>
  
  <p>But that doesn't work: <code>Exception Description: Error compiling the query [updateEmployee: Update EmployeeImpl e SET e.phonenumber = :number WHERE e.id = :id], line 1, column 28: invalid access of attribute [phonenumber] in SET clause target [e], only state fields and single valued association fields may be updated in a SET clause.</code></p>
  
  <p>Question is, how do I update an <code>@ElementCollection</code>? If it's possible i'd like to do it with a jpql query. </p>