title: JPA @OrderBy don't work in @ElementCollection
body: <p>Good day all.</p>
  <p>A have a simple Entity that have @ElementCollection of Set inside.
  The scheme of DB tables - therefore: <a href="https://i.stack.imgur.com/ZXZTB.png" rel="nofollow noreferrer">enter image description here</a></p>
  <pre><code>@Entity
  @Table(name = &quot;Dealer&quot;)
  public class Dealer implements java.io.Serializable{
   private int id;
  private Set&lt;Integer&gt; modelYears = new LinkedHashSet&lt;Integer&gt;(0);
  ...
    @Id
      @GeneratedValue
      @Column(name = &quot;Id&quot;, unique = true, nullable = false)
      @XmlTransient
      public int getId() {
          return this.id;
      }
  
      @ElementCollection(fetch = FetchType.LAZY)
      @CollectionTable(name = &quot;DealerModelYear&quot;, joinColumns = @JoinColumn(name = &quot;DealerId&quot;))
      @Column(name = &quot;ModelYear&quot;)
      @OrderBy(&quot;ModelYear ASC&quot;)
      @XmlElementWrapper
      @XmlElement(name = &quot;modelYear&quot;)
          public Set&lt;Integer&gt; getModelYears() {
          return this.modelYears;
      }
  
      public void setModelYears(Set&lt;Integer&gt; modelYears) {
          this.modelYears = modelYears;
      }
  </code></pre>
  <p>And here Don't work  @OrderBy(&quot;ModelYear ASC&quot;) - why&gt;? it's must be implemented during SQL request to DB. (moreover in official documentation have similar example with Set )</p>
  <p>Thank you in advance.</p>