问题
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?
回答1:
It is not supported based on the bug report.
来源:https://stackoverflow.com/questions/24523408/how-to-make-tableperhierarchy-false-and-use-discriminator