Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.0
-
Fix Version/s: 1.0.2
-
Component/s: Persistence
-
Labels:None
-
Environment:Windows 2000, Java 5, Oracle 10 / Vista, Java 6, HSQLDB
Description
When using 'tablePerHierarchy false' and a custom table name for a domain class and not specifying custom table names for subclasses of that class,
Grails fails to generate a correct database schema for these classes. Depending on the platform Grails fails to start or crashes when trying to save an instance of a subclass.
Specifying custom table names for the subclasses or deleting the 'table xyz' directive from the base class removes the problem.
Example classes to reproduce behaviour:
class Base {
String bogus
static mapping = { tablePerHierarchy false table "base_table" }
}
class Derived extends Base { String extra }
Issue Links
| This issue is duplicated by: | ||||
| GRAILS-2411 | Inheritance Mapping Creates Incorrect Schema When tablePerHierarchy Is False |
|
|
|
| GRAILS-2227 | tablePerHierarchy Bug when accessing collection of subclasses |
|
|
|
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
I got this error but it was because my parent object wasn't abstract. Try making the parent object abstract and add tablePerHierarchy false to the parent objects mapping and then it should work.
This has been tested in version 1.2.0