title: GORM cascade-delete off
body: <p>I have three domains models <code>Type1</code>, <code>Type2</code> and <code>Details</code> following the relationship below:</p>
  
  <pre><code>class Type1 {
    static hasMany = [detail: Detail]
  }
  class Type2 {
    static hasMany = [detail: Detail]
  }
  class Detail {
    Type1 type1
    Type2 type2
    static belongsTo = [Type1, Type2]
    static constraints = {
      type1(nullable:true)
      type2(nullable:true)
    }
  }
  </code></pre>
  
  <p>The problem is that I can't get <code>Type1.detail</code> to be transfered to <code>Type2.detail</code> whenever <code>Type1</code> is to be converted to <code>Type2</code> (<em>Note: Type1 and Type2 is only a child of <code>java.lang.Object</code></em>). In other words (in a controller):</p>
  
  <pre><code>Type1 type1 = Type1.get(params.id)
  List type1Details = Detail.findAllByType1(type1)
  type1.detail.clear()
  
  Type2 type2 = new Type2()
  // transfer other properties of type1 to type2
  type1Details.each { type2.addToDetail(it) }
  
  if(type2.save(flush:true) {
    type1.save(flush:true)
    type1.delete(flush:true)
  }
  </code></pre>
  
  <p>The question is, only updating <code>type1Details</code>, how can we set <code>type1Details*.type1 = null</code> and <code>type1Details*.type2 = type2</code>?</p>