Abstract domain class and tablePerHierarchy

448 views Asked by At

In my Grails 3.2.6 app I have 2 classes:

abstract class Base {
  static mapping = {
    tablePerHierarchy false
  }    
}

and

class Child extends Base {
  static mapping = {
    collection 'child'
  }
}

Upon saving the instances of Child are dumped into "base" collection (with _class = Child field) instead of "child".

How to make it work right?

UPDATE

I defined the Base as a trait under src/main/groovy:

trait Base { }

and

class Child implements Base { }

then it worked properly.

1

There are 1 answers

1
elixir On

In your Child class mapping method, add this

table "child"