title: hibernate annotations: map a list that keeps order
body: <p>I want to do a one to many mapping that keeps order. The order itself is complex and related to business logic and does not have a single field or simple logic that can represent it.</p>
  
  <p>What I want is to load an object, swap two elements (or more) in the list and save and do <code>session.update(object)</code>. I expect next time the element is loaded to keep the right order however it does not.</p>
  
  <p>What I am doing:</p>
  
  <pre><code>@Entity
   public class Product {
  
  @Id @GeneratedValue(strategy=GenerationType.AUTO)
  private long id;
  @OneToMany(fetch=FetchType.EAGER)
  private List&lt;Image&gt; images = new ArrayList&lt;Image&gt;();
  
    blah blah blah
  
   }
  </code></pre>