6.5.2.3 Inheritance Strategies 2.3.8

See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # 6.5.2.3 Inheritance Strategies - Reference Documentation Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari Version: 2.3.8 ## 6.5.2.3 Inheritance Strategies By default GORM classes use `table-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
    }
The mapping of the root `Payment` class specifies that it will not be using `table-per-hierarchy` mapping for all child classes. | Quick Reference (hide)