title: How to retrieve the latest created db entry?
body: <p>I have the following class and need to manually increment the nextId field.</p>
  
  <pre><code>class SomeIdClass {
  
  Family family
  Integer nextId = 0
  long timeCreated = new Date().time }
  </code></pre>
  
  <p>So far I've been trying to retrieve and the latest db entry to increment it and I'm just not having any luck with that. Or am I just going about it in a totally wrong manner?</p>
  
  <p>Thaks</p>
  
  <p>ps: this is what I tried but get a list of Package.SomeId objects</p>
  
  <pre><code> def si = SomeId.executeQuery(" from SomeId where nextId =  (select max( nextId ) from SomeId) ")
  </code></pre>