title: Mapping a list in hibernate by ordering instead of an index-field
body: <p>This works:</p>
  
  <pre><code>&lt;hibernate-mapping&gt;
      &lt;class name="Train" table="Trains"&gt;
  
          &lt;id column="id" name="id" type="java.lang.String" length="4"&gt;
              &lt;generator class="assigned" /&gt;
          &lt;/id&gt;
          &lt;set name="trips" cascade="all"&gt;
              &lt;key column="trainId"/&gt;
              &lt;one-to-many class="Trip"/&gt;
          &lt;/set&gt;
  
      &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>But my trips are all naturally ordered by their <code>scheduledDate</code>. I would like to replace the <code>Set</code> with a <code>List</code>. Changing the collection to:</p>
  
  <pre><code>        &lt;list name="trips" cascade="all" order-by="scheduledDate"&gt;
              &lt;key column="trainId"/&gt;
              &lt;one-to-many class="Trip"/&gt;
          &lt;/list&gt;
  </code></pre>
  
  <p>does not work, since it now requires an <code>&lt;index/&gt;</code>. I don't want to add an index to my table, because <em>the ordering is given by the date</em>.</p>
  
  <p>Any way this can be done? Or should I just get the <code>Set</code> from Hibernate, and then sort it myself in code? Seems unnecessary when we already have it ordered by the DB.</p>