title: Objects not being saved correctly in grails
body: <p>I have an error which only happens when I call the code from an external source.</p>
  
  <p>I am getting a stack overflow exception due to the created object not getting saved, meaning I cannot create a link between objects.</p>
  
  <p>my code is as follows:</p>
  
  <pre><code>private addToJob (Manufacture m, Job j, int count = 0){
      if(m.id)
          j.addToManufactures(m)
      else{
          sleep(1000)
          m.save(flush:true,failOnError:true)
          addToJob(m,j,count++);
      }
      if(count &gt;= 10)
          throw new Exception("missing ID")
  }
  </code></pre>
  
  <p>Does anyone know what using a flush on save is not giving the Manufacture object an id?
  I am using MySql.</p>