Grails
  1. Grails
  2. GRAILS-8709

Problem with old-style abstract inheritance in grails 2.0

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 2.0 final
    • Fix Version/s: None
    • Component/s: Persistence

      Description

      Old style abstract inheritance without creating db table for abstract class does not work in grails 2.0 as it described here: http://grails.org/doc/2.0.0/guide/gettingStarted.html#upgradingFromPreviousVersionsOfGrails.

      I created abstract class in the src/groovy:

      package testgorm

      abstract class AbstractEntity

      { String name; String description; }

      and domain class in grails-app/domain:

      package testgorm

      class Entity extends AbstractEntity {

      String firstName;

      static constraints = {
      }
      }

      Application does not run with error:

      Running Grails application

      Error 2012-01-31 20:19:22,239 [Thread-10] ERROR context.ContextLoader - Context initialization failed
      Message: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsDomainException: Identity property not found, but required in domain class [testgorm.Entity]
      Line
      Method
      ->> 303
      innerRun in java.util.concurrent.FutureTask$Sync
      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      138 run in java.util.concurrent.FutureTask
      886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
      908 run in ''
      ^ 680
      run . . in java.lang.Thread

      Caused by GrailsDomainException: Identity property not found, but required in domain class [testgorm.Entity]
      ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        138 run in java.util.concurrent.FutureTask
        886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
        908 run in ''
        ^ 680
        run . . in java.lang.Thread
        Error 2012-01-31 20:19:22,268 [Thread-10] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsDomainException: Identity property not found, but required in domain class [testgorm.Entity]
        Message: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsDomainException: Identity property not found, but required in domain class [testgorm.Entity]
        Line
        Method
        ->> 303
        innerRun in java.util.concurrent.FutureTask$Sync
      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        138 run in java.util.concurrent.FutureTask
        886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
        908 run in ''
        ^ 680
        run . . in java.lang.Thread

      Caused by GrailsDomainException: Identity property not found, but required in domain class [testgorm.Entity]
      ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        138 run in java.util.concurrent.FutureTask
        886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
        908 run in ''
        ^ 680
        run . . in java.lang.Thread

      Process finished with exit code 1


      Without inheritance from AbstractEntity in src/groovy all works fine.

        Activity

        Hide
        Graeme Rocher added a comment -

        I imagine adding

        Long id

        To Entity will provide a workaround for this issue

        Show
        Graeme Rocher added a comment - I imagine adding Long id To Entity will provide a workaround for this issue
        Hide
        Vladimir Velikiy added a comment -

        Problem was decided with the removal of inheritance in the Entity class, with the subsequent starting of application and with the repeated addition of inheritance from AbstractEntity. After this, I could not reproduce problem. The addition of Long id to Entity was not required. Thanks for the given attention. Close this issue, please.

        Show
        Vladimir Velikiy added a comment - Problem was decided with the removal of inheritance in the Entity class, with the subsequent starting of application and with the repeated addition of inheritance from AbstractEntity. After this, I could not reproduce problem. The addition of Long id to Entity was not required. Thanks for the given attention. Close this issue, please.

          People

          • Assignee:
            Unassigned
            Reporter:
            Vladimir Velikiy
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development