hibernate - Grails 2.5.0 Second level Abstract domain class creates it's own table even though it shouldn't -


if create abstract domain class such this:

abstract class domainbase {      localdatetime created = localdatetime.now()     localdatetime updated      static constraints = {         created nullable: false         updated nullable: true     }      static mapping = {         tableperconcreteclass true         created column: 'created'         updated column: 'updated'     }      def beforeupdate() {         this.updated = localdatetime.now()     } } 

then can extend other domain classes , inherit (the properties, constraints, mappings , interceptors), , generated database contains no concrete domain_base table. works expected.

however, if create abstract class extends domainbase, example:

abstract class entitybase extends domainbase {     user createdby     boolean active = true      static constraints = {         createdby nullable: false         active nullable: true     }      static mapping = {         tableperconcreteclass true         createdby column: 'created_by_id'         active column: 'active'     } } 

then generated database have concrete entity_base table. , problem.

proposed solution gather have base classes ordinary pogo's , not domain objects, mapping not inherited , i'm lazy copy paste mapping every single domain class create.

also if try make these domain objects traits can't run app due breaking npe during compilation.

is there simple , elegant way solve this?

as far know can't inherit mapping in grails 2.4.x, think in 2.5.0 same...

as workaround can use , change scaffolding template domain classes.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -