Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.1-beta3
-
Fix Version/s: 2.0-M1
-
Component/s: Persistence
-
Labels:None
Description
Using 1.1b3 I am unable to change a field's mapping type in the db for a subclass if that subclass has a mapping definition itself. In this case the default in the DB for a Boolean would be 0/1 and I'm trying to use Y/N. If there's no mapping definition in the subclass the field is changed to Y/N. This is sort of related to http://jira.codehaus.org/browse/GRAILS-3130, but wanted to document that this case seems a bit worse in that I found no obvious workaround.
abstract class Parent { Boolean active static mapping = { active type: 'yes_no' } }
//WITH NO MAPPING WE'RE OK class Child extends Parent { String someField }
//DOESN'T WORK... class Child extends Parent { String someField static mapping = { sort: someField } }
//DOESN'T WORK... class Child extends Parent { String someField static mapping = { active type: 'yes_no' sort: someField } }
//DOESN'T WORK... class Child extends Parent { Boolean active //DUPLICATED FROM PARENT String someField static mapping = { active type: 'yes_no' sort: someField } }
If you change your parent class to non-abstract it works as expected