Grails
  1. Grails
  2. GRAILS-513

Constraints not inherited for inhertitance POJO domain models

    Details

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

      Description

      When using a Java domain model with inheritance and supplying the WhateverContraints.groovy files, constraints are not inherited for extending classes, eg:

      class A
      has "AConstraints.groovy", which are invoked for validate()

      class B extends A
      does not have any constraints of it's own, and nothing is used for validate() so I get raw DB errors when trying to save invalid objects

      In my case class B was not providing any new DB columns that A did not have itself, although it does have a few extra properties, which are represented by different DB tables. So I thought it would be reasonable that B should inherit constraints from A.

      Also, is it worth considering the situation where a developer might want to inherit superclass constraints and override some of them too?

        Activity

        Hide
        Jesse Jackson added a comment -

        This issue still seems to affects my *Constraints.groovy files with Grails 1.0.3. Any chance of this being fixed soon as it's a fairly major issue that has been around for a couple of years now?

        Show
        Jesse Jackson added a comment - This issue still seems to affects my *Constraints.groovy files with Grails 1.0.3. Any chance of this being fixed soon as it's a fairly major issue that has been around for a couple of years now?
        Hide
        Graeme Rocher added a comment -

        Moving non-critical issues that aren't going to make it into 1.1 to 1.2

        Show
        Graeme Rocher added a comment - Moving non-critical issues that aren't going to make it into 1.1 to 1.2

          People

          • Assignee:
            Unassigned
            Reporter:
            Maurice Nicholson
          • Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development