在 hibernate 状态下,我想选择鉴别器值。有点像
从Animal中选择discriminator, id, name, age
我的想法是将这个查询的结果发送到客户端,这样我就可以根据鉴别器列的值(即猫、狗、大象等)显示不同的图标。
这可能吗?怎么办?
最佳答案
您可以按如下方式进行:
select a.class, a.id, a.name, a.age from Animal a
The special property class accesses the discriminator value of an instance in the case of polymorphic persistence.
关于java hibernate : selecting the discriminator column in polymorphic hql query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5584038/