Mark,
I remember you asking about using src/groovy classes as base classes for Domains, and I was sure we'd done that, so I tried it again.
Steps:
Create new grails project
Create class in src/groovy/dom called BaseDom.groovy like this:
package dom
class BaseDom {
String baseString
Long baseLong
}
Create a new Domain ChildDom.groovy in the domains directory like this (I added some mappings for fun:
package test.domain
import dom.BaseDom
class ChildDom extends BaseDom {
String childString
Long childLong
Double childDouble
static constraints = {
baseString( nullable: true )
childLong( nullable: false )
childDouble( nullable: true )
}
static mapping = {
baseString( column: 'bstr' )
}
}
You should be able to see what DDL will be generated by running schema-export:
grails dev schema-export generate .\ddl.sql
That should show you the DDL it would use to generate a single table for ChildDom containing the fields from BaseDom:
drop table child_dom if exists;
create table child_dom (
id bigint generated by default as identity,
version bigint not null,
base_long bigint not null,
bstr varchar(255),
child_double double,
child_long bigint not null,
child_string varchar(255) not null,
primary key (id)
);
Is this what you were asking about?