7.5.2.3 Inheritance Strategies - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari
Version: 3.1.10
7.5.2.3 Inheritance Strategies
By default GORM classes usetable-per-hierarchy
inheritance mapping. This has the disadvantage that columns cannot have a NOT-NULL
constraint applied to them at the database level. If you would prefer to use a table-per-subclass
inheritance strategy you can do so as follows:class Payment { Integer amount static mapping = { tablePerHierarchy false } }class CreditCardPayment extends Payment { String cardNumber }
Payment
class specifies that it will not be using table-per-hierarchy
mapping for all child classes.