title: Domain object string list - Adding on the fly
body: <p>Maybe this is an issue with persistance and the domain object. So I have a list of manual notes that can be added to a person. My person class looks similar to this (I've wrapped the object in transients to ignore persistence):</p>
  
  <pre><code>class Person {
  ...
  List&lt;String&gt; notes = new ArrayList&lt;String&gt;()
  ...
  }
  </code></pre>
  
  <p>When I update a person with a note (textfield on view will allow note to be added), I want to do something simple like adding the new note to the array list tied to the person:</p>
  
  <pre><code>class PersonController {
  ...
  def update() {
      def contactInstance = Contact.get(params.id)
      if (!contactInstance) {
          flash.message = message(code: 'default.not.found.message', args: [message(code: 'contact.label', default: 'Contact'), params.id])
          redirect(action: "list")
          return
      }
  
      if (params.version) {
          def version = params.version.toLong()
          if (contactInstance.version &gt; version) {
              contactInstance.errors.rejectValue("version", "default.optimistic.locking.failure",
                        [message(code: 'contact.label', default: 'Contact')] as Object[],
                        "Another user has updated this Contact while you were editing")
              render(view: "edit", model: [contactInstance: contactInstance])
              return
          }
      }
  
      contactInstance.properties = params
  
      /**
       * Check for inactive - Then flag with user and date tag
       */
      if(params.isActive == null) {
          DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
          Date date = new Date();
          contactInstance.properties.isActiveNote = "Made inactive by " + session.user + " on " + dateFormat.format(date) + "."
      }
  
      /**
       * Date stamp of the note itself
       */
  
      if(params.notes.equals("")) {}
      else {
          DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
          Date date = new Date();
          //contactInstance.properties.notes = contactInstance.properties.notes + "    " + params.notes + " - (" + dateFormat.format(date) + " " + session.user + ");"
          contactInstance.allThese.add(contactInstance.properties.notes)
          println(contactInstance.allThese)
      }
  
  
      if (!contactInstance.save(flush: true)) {
          render(view: "edit", model: [contactInstance: contactInstance])
          return
      }
  
      flash.message = message(code: 'default.updated.message', args: [message(code: 'contact.label', default: 'Contact'), contactInstance.id])
      redirect(action: "show", id: contactInstance.id)
  }
  ...
  }
  </code></pre>
  
  <p>The call to update from my gsp:</p>
  
  <pre><code>&lt;g:actionSubmit class="save" action="update" value="${message(code:'default.button.update.label', default: 'Update')}" /&gt;
  </code></pre>
  
  <p>But it just seems to store the array with a single note. Is there a persistance issue with Grails domain objects and collections? It could very well be a simple issue on my end!</p>
  
  <p>Thanks for all the help.</p>