title: auto incrementing integer field in Grails
body: <p>I have field <code>int displayOrder = 1</code> in Grails domain object and would like to increment it by 1 each time the domain object gets saved.</p>
  
  <p>If I have domain object Widget that has one-to-many relationship with Pix, every time Widget gets a new Pix, Pix needs to have displayOrder incremented. </p>
  
  <p>What would be the most prudent way of setting this up? Preferably count should start from 1 to  keep confusion to minimum when someone wants to change the display order. I thought about just duplicating the ID, but then we are possibly looking at displayOrder of 1123, followed by 1169 , etc., so that's not a practical option.</p>
  
  <p>The collection of Pixes belonging to Widget is a sortedSet.</p>