title: TransientObjectException on nullable property in Grails
body: <p>I have the following entity </p>
  
  <pre><code>class Thesis extends Article {
     String description
     Topic topic
     User assignee
     User supervisor
     ...
     static constraints = {
         supervisor nullable: true
     ...
        supervisor validator: {supervisor -&gt;
           if (supervisor?.id != null &amp;&amp; !User.get(supervisor.id)) {
              'not.found'
           }
        }
     }
  }
  </code></pre>
  
  <p>Creating and saving new instance with no supervisor work just fine.</p>
  
  <p>However when I try to remove (set to null) supervisor from existing Thesis instance I end up with TransientObjectException. I'm probably missing something about data binding because if I don't bind form data to thesisInstance and simply just set "supervisor" property to null it will get saved with no issues.</p>
  
  <pre><code>def thesisInstance = Thesis.get(id)
  thesisInstance.properties = params.thesis
  if (thesisInstance.supervisorId == null){
     thesisInstance.supervisor = null
  }
  thesisInstance.save()
  </code></pre>
  
  <p>EDIT: params.thesis map looks like this (disclaimer: these are dummy data)</p>
  
  <pre><code>thesis.tags.title: ruby
  thesis.version: 7
  thesis.topic.id: 13
  thesis.supervisor.id: 
  thesis.status: FINISHED
  thesis.id: 18
  thesis.title: Implementation of Ruby Killing Machine
  thesis.type: BACHELOR
  thesis.assignee.fullName: Somebody
  thesis.university.id: 1
  thesis.grade: A
  thesis.supervisor.fullName: 
  thesis.thesisAbstract: Implementation of Ruby Killing Machine that will kill people that are filled in an HTML form.
  thesis.description: Implementation of Ruby Killing Machine that will kill people that are filled in an HTML form.
  thesis.assignee.id: 4
  </code></pre>
  
  <p>As you can see thesis.supervisor.id is not populated and consequently thesisInstance.supervisor is set to new User instance witthout ID. Thus the need for "thesisInstance.supervisor = null" </p>
  
  <p>I've found exactly same problem on  [1] but it's unanswered.</p>
  
  <p>[1] <a href="http://grails.1312388.n4.nabble.com/Data-Binding-and-Null-ifying-problems-in-G1-2-0-td1339929.html" rel="nofollow">http://grails.1312388.n4.nabble.com/Data-Binding-and-Null-ifying-problems-in-G1-2-0-td1339929.html</a></p>