title: Error during merge after async task
body: <p>I have an application which basically calls multiple webservices, stores the data received from those webservices and renders it to the user. I have an async task that call all the webservices and it looks something like this:</p>
  
  <pre><code>List&lt;Promise&gt; t = new ArrayList&lt;Promise&gt;()
  def TIMEOUT_TIME = 6
  
      t[0] = task {
          def responseFrom0 = webserviceRequestService.getResponse(0)
          if(responseFrom0){
              return responseFrom0
          }
      }
  
      t[1] = task {
          def responseFrom1 = webserviceRequestService.getResponse(1)
          if(responseFrom1){
              return responseFrom1
          }
      }
  </code></pre>
  
  <p>The action getResponse looks something like this:</p>
  
  <pre><code>    List&lt;ResponseResult&gt; result = new ArrayList&lt;TravelQuote&gt;()
  
      try {
          wsClient = prepareRequestMap()
          wsResponse = externalWebservice.getQuotes(wsClient)
          wsResponse.responseList.each  {
              ResponseResult responseResult = new ResponseResult()
  
              //populate properties of ResponseResult
              responseResult.save(failOnError:true, flush:true)
              result.add(responseResult)
  
          }
  
      } catch(Exception e){
          log.error e.message
          e.printStackTrace()
      }
  
      return result
  </code></pre>
  
  <p>And at the end, I collect all the responses from all webservices like this:</p>
  
  <pre><code>    result.each {
          if(it){
              try{
                  it=it.merge()                                       
              }catch (Exception e){
                  log.error("Error occured while merging responses... : ${e.message}")
              }
  
          }
      }
  </code></pre>
  
  <p>Now, the issue here is I get this exception from the last block of code</p>
  
  <p>not-null property references a null or transient value: ResponseResult.dateCreated; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value: ResponseResult.dateCreated</p>
  
  <p>The dateCreated comes from this class which I have implemented on all of my domain classes.</p>
  
  <pre><code>abstract class AbstractPersistentObject implements Serializable{
      static final long serialVersionUID = 1L;    
      Date dateCreated
      Date lastUpdated    
  }
  </code></pre>
  
  <p>The weird thing about this issue is, this happens only on production environment, no matter what I do, I cannot replicate this in any other environments. And also, once this happens, the server just throws that particular issue every time that code is run until the server is restarted. After a restart, this code works fine.</p>
  
  <p>I am running out of ideas, anyone has any ideas?</p>