Grails
  1. Grails
  2. GRAILS-8345

Grails default controller implementation does not properly validate domain objects before attempting to persist to database

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.7
    • Fix Version/s: None
    • Labels:
      None

      Description

      When attempting to save a new domain object, the default implementation of the controller's save makes a new instance of the object and calls hibernate to save. If there are any errors (i.e. constraint validation fails), the page is rendered again w/ the list of failing constraints. However, if a user then proceeds to view a list of all saved objects via a call to the controller's list method, the invalid object is still persisted to the database and now the database is corrupted.

      1. constraints fail.jpg
        146 kB
      2. persistence success.jpg
        94 kB

        Activity

          People

          • Assignee:
            Jeff Scott Brown
            Reporter:
            Michael Hatch
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development