Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
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 ''
^ 680run . . 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]
LineMethod
->> 303innerRun in java.util.concurrent.FutureTask$Sync - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
138 run in java.util.concurrent.FutureTask 886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker 908 run in ''
^ 680run . . 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 ''
^ 680run . . in java.lang.Thread
Process finished with exit code 1
Without inheritance from AbstractEntity in src/groovy all works fine.
I imagine adding
Long id
To Entity will provide a workaround for this issue