grails - How to inherit GORM mapping from non domain class? -
permanently have tables , hibernate classes mapping annotations. , classes have abstract superclass mapping annotations also. in superclass there no table association mapping. tables identified in subclasses. i'm trying migrate mapping gorm model. strategies: tableperhierarchy , tablepersubclass not approach case because tables created , can't changed. created superclass in 'src/groovy/somepackage/' , want inherit mapping , constraints class subclasses in 'domain' folder. constraints works mapping can't find documentation how this. have ideas?
example.
in non-domain folder:
absract class { string static mapping = { column: "column_a" } } in domain folder:
class b extends { string b static mapping = { b column: "column_b" } } and
class c extends { string c static mapping = { c column: "column_c" } } needs 2 tables column 'column_a' in each of them.
it's possible using clone , delegate features. here's did:
class b extends { static mapping = { def copymapping = a.mapping.clone() copymapping.delegate = delegate copymapping.call() } }
Comments
Post a Comment