how to make tablePerHierarchy false and use discriminator?

这一生的挚爱 提交于 2019-12-13 05:02:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!