hibernategrailsgrails-ormtable-per-hierarchydiscriminator

how to make tablePerHierarchy false and use discriminator?


A question like what I need is asked here but it's answer is not satisfying what I need. I have classes like this :

abstract class A{
   String a
}
class B extends A{
   String b
}
class C extends A{
   String c
}

I want to have a table for each class, so I add tablePerHierarchy and set it false like this:

abstract class A{
   String a
   static mapping = {
       tablePerHierarchy false
   }
}

but when I run the program and it creates a database there are no discriminator, and I want to query table A and find out if it is B, or C? How Could I add discriminator to this strategy?


Solution

  • It is not supported based on the bug report.