如何使tablePerHierarchy为false并使用鉴别器? [英] how to make tablePerHierarchy false and use discriminator?

查看:159
本文介绍了如何使tablePerHierarchy为false并使用鉴别器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此处提供像我需要的问题但它的回答并不满足我所需要的。我有这样的课程:


pre $ 抽象类A {
字符串a
}
class B extends A {
String b
}
class C extends A {
String c
}

我想为每个类都有一个表,所以我添加tablePerHierarchy并将其设置为如下所示:

 抽象类A {
字符串a
静态映射= {
tablePerHierarchy false
}
}

但是当我运行程序并创建一个数据库时没有鉴别器,我想查询表A并找到如果它是B,或C?我怎样才能在这个策略中添加鉴别器? 错误报告


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?

解决方案

It is not supported based on the bug report.

这篇关于如何使tablePerHierarchy为false并使用鉴别器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆