title: grails no error and validate true but does not save. Hibernate no update
body: <p>grails no error and validate true but does not save.</p>
  
  <p>I have a method calling .save() but does not save the data in the db. I tried the ff:</p>
  
  <ol>
  <li>called FailOnError: true but does not show anything that fails</li>
  <li>validate(), it does return true </li>
  <li>hasErrors(), it does return true put</li>
  <li>put return objectInstance and showed that the value changed </li>
  <li>set flush: false</li>
  </ol>
  
  <p>but amidst all the things above not showing any validation failure, it still won't save in the db. I tried logging the hibernate and it does not show the "update" method for that instance. Mayeb that is why no update is happening. But my big question is why? Why would it not call the update when there is no error or anything? what am I missing. thanks.</p>
  
  <p>here is my controller code:</p>
  
  <pre><code>def obpViewFlow = {
  
      start {
          action {
              def caseInstance = CmCase.get(params.caseId as Long)
              .....
          }
          on("success").to 'obpViewCase'
          on(Exception).to 'obpViewCase'
      }
  
      obpViewCase {
          on("edit").to 'edit'
          on("cancel").to 'cancel'
      }
  
      edit {
          redirect( action:"obpEdit", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  
      cancel {
          redirect( action:"obpView", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }def obpViewFlow = {
  
      start {
          action {
              def caseInstance = CmCase.get(params.caseId as Long)
              ObpCase obpCaseInstance = caseService.getObpCase(caseInstance)
  
              // set obpCaseInstance to flow scope, instance for view state
              flow.obpCaseInstance = obpCaseInstance
              if (params.created) {
                  flash.message = "OBP Case has been successfully saved."
              }
          }
          on("success").to 'obpViewCase'
          on(Exception).to 'obpViewCase'
      }
  
      obpViewCase {
          on("edit").to 'edit'
          on("cancel").to 'cancel'
      }
  
      edit {
          redirect( action:"obpEdit", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  
      cancel {
          redirect( action:"obpView", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  }
  
  def obpEditFlow = {
  
      start {
          action {
              def caseInstance = CmCase.get(params.caseId as Long)
              flow.appDate = caseInstance.applicationDate
              ObpCase obpCaseInstance = caseService.getObpCase(caseInstance)
  
              // set obpCaseInstance to flow scope, instance for view state
              flow.obpCaseInstance = obpCaseInstance
  
              // get the following list to populate dropdown fields
              def residenceTypeList = ResidenceType.list()
              def visualImpairmentCauseList = VisualImpairmentCause.list()
              def referralSourceList = ReferralSource.list()
  
              [residencesType: residenceTypeList, visualImpairmentsCause: visualImpairmentCauseList, referralSources: referralSourceList]
          }
          on("success").to 'obpEditCase'
          on(Exception).to 'obpEditCase'
      }
  
      obpEditCase {
          on("save") {
  
              this.bindObpFields(flow, caseService, params)
              if (!this.bindAndValidateConstraints(flow, caseService, params)) {
                  flow.olderBlindInstance = flow.obpCaseInstance.olderBlind
                  return error()
              }
          }.to 'save'
  
          on("cancel").to 'cancel'
      }
  
  
      save {
          action {
              def obpCaseInstance = flow.obpCaseInstance
              try {
                  HttpSession theSession = request.getSession();
  
                  def obpCase = caseService.saveUpdateObpCase(obpCaseInstance, theSession.currentUser)
  
              }
              catch(Exception ie) {
                  flow.exceptionMessage = ie.getMessage()
                  throw ie
              }
          }
  
          on("success").to 'finish'
          on(Exception).to 'handleError'
      }
  
      finish {
      def obpViewFlow = {
  
      start {
          action {
              def caseInstance = CmCase.get(params.caseId as Long)
              ObpCase obpCaseInstance = caseService.getObpCase(caseInstance)
  
              // set obpCaseInstance to flow scope, instance for view state
              flow.obpCaseInstance = obpCaseInstance
              if (params.created) {
                  flash.message = "OBP Case has been successfully saved."
              }
          }
          on("success").to 'obpViewCase'
          on(Exception).to 'obpViewCase'
      }
  
      obpViewCase {
          on("edit").to 'edit'
          on("cancel").to 'cancel'
      }
  
      edit {
          redirect( action:"obpEdit", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  
      cancel {
          redirect( action:"obpView", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  }
  
  def obpEditFlow = {
  
      start {
          action {
              def caseInstance = CmCase.get(params.caseId as Long)
              flow.appDate = caseInstance.applicationDate
              ObpCase obpCaseInstance = caseService.getObpCase(caseInstance)
  
              // set obpCaseInstance to flow scope, instance for view state
              flow.obpCaseInstance = obpCaseInstance
  
              // get the following list to populate dropdown fields
              def residenceTypeList = ResidenceType.list()
              def visualImpairmentCauseList = VisualImpairmentCause.list()
              def referralSourceList = ReferralSource.list()
  
              [residencesType: residenceTypeList, visualImpairmentsCause: visualImpairmentCauseList, referralSources: referralSourceList]
          }
          on("success").to 'obpEditCase'
          on(Exception).to 'obpEditCase'
      }
  
      obpEditCase {
          on("save") {
  
              this.bindObpFields(flow, caseService, params)
              if (!this.bindAndValidateConstraints(flow, caseService, params)) {
                  flow.olderBlindInstance = flow.obpCaseInstance.olderBlind
                  return error()
              }
          }.to 'save'
  
          on("cancel").to 'cancel'
      }
  
  
      save {
          action {
              def obpCaseInstance = flow.obpCaseInstance
              try {
                  HttpSession theSession = request.getSession();
  
                  def obpCase = caseService.saveUpdateObpCase(obpCaseInstance, theSession.currentUser)
  
              }
              catch(Exception ie) {
                  flow.exceptionMessage = ie.getMessage()
                  throw ie
              }
          }
  
          on("success").to 'finish'
          on(Exception).to 'handleError'
      }
  
      finish {
  
          redirect( action:"obpView", controller:"olderBlind", params:["created": "created", caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  
      handleError() {
          action {
              return success()
          }
  
          on("success").to 'obpEditCase'
      }
  
      cancel {
          redirect( action:"obpView", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  }
          redirect( action:"obpView", controller:"olderBlind", params:["created": "created", caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  
      handleError() {
          action {
              return success()
          }
  
          on("success").to 'obpEditCase'
      }
  
      cancel {
          redirect( action:"obpView", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  }
  }
  
  def obpEditFlow = {
  
      start {
          action {
              def caseInstance = CmCase.get(params.caseId as Long)
              ....
          }
          on("success").to 'obpEditCase'
          on(Exception).to 'obpEditCase'
      }
  
      obpEditCase {
          on("save") {
  
              this.bindObpFields(flow, caseService, params)
              if (!this.bindAndValidateConstraints(flow, caseService, params)) {
                  flow.olderBlindInstance = flow.obpCaseInstance.olderBlind
                  return error()
              }
          }.to 'save'
  
          on("cancel").to 'cancel'
      }
  
  
      save {
          action {
              def obpCaseInstance = flow.obpCaseInstance
              try {
                  HttpSession theSession = request.getSession();
  
                  def obpCase = caseService.saveUpdateObpCase(obpCaseInstance, theSession.currentUser)
  
              }
              catch(Exception ie) {
                  flow.exceptionMessage = ie.getMessage()
                  throw ie
              }
          }
  
          on("success").to 'finish'
          on(Exception).to 'handleError'
      }
  
      finish {
  
          redirect( action:"obpView", controller:"olderBlind", params:["created": "created", caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  
      handleError() {
          action {
              return success()
          }
  
          on("success").to 'obpEditCase'
      }
  
      cancel {
          redirect( action:"obpView", controller:"olderBlind", params:[caseId: flow.obpCaseInstance.olderBlind.cmCaseIdCmCase])
      }
  }
  </code></pre>
  
  <p>here is my service code for the save</p>
  
  <pre><code>def CmCase saveUpdateCase(CmCase caseInstance, Users currentUser) {
      if (!caseInstance.save(flush:true)) {
  
          if (log.isDebugEnabled()) {
              caseInstance.errors.allErrors.each { log.debug it }
          }
  
          throw new CaseException(message: "case.cmCase.exception", caseInstance: caseInstance)
      }
      return caseInstance
  }
  </code></pre>
  
  <p>Hibernate showing all select and insert when doing other queries but not update. </p>