Hibernate继承映射中来自单独表的判别器值

时间:2011-10-05 13:39:43

标签: java hibernate inheritance discriminator

我有两个表,price_feedprice_feed_type。价格Feed将包含价格Feed的不同实现的数据。

现在,这通常是通过<discriminator>标记完成的,price_feed表中有一个鉴别字段。但是,在系统的上下文中,最好在price_feed_type表中包含此字段。我遇到了<discriminator formula="..."/>方法,并试图使用它。

一种解决方案如下(假设这是在formula属性中输入的):

(SELECT implementing_class FROM price_feed_type INNER JOIN price_feed ON price_feed.price_feed_type_id = price_feed_type.price_feed_type_id")

另一种解决方案如下,我应该注意到我已经尝试了priceFeedIDprice_feed.price_feed_type_id

(SELECT implementing_class FROM price_feed_type WHERE price_feed_type.price_feed_type_id = price_feed.price_feed_type)

任何一个都会出现以下错误:

org.postgresql.util.PSQLException: ERROR: column timedprice3_.implementing_class does not exist

额外的注释,没有parantheses,我收到错误:

org.postgresql.util.PSQLException: ERROR: syntax error at or near "SELECT"

关于如何解决此问题的任何想法?

编辑:

添加到目前为止我发现的内容:

使用其中任何一个,如果我执行SELECT *,然后在外部执行SELECT implementing_class,则会出现不同的错误。完整代码:

(SELECT implementing_class FROM (SELECT * FROM price_feed_type INNER JOIN price_feed ON price_feed.price_feed_type_id = price_feed_type.price_feed_type_id) AS foo)

错误是:

org.postgresql.util.PSQLException: ERROR: syntax error at or near "."

0 个答案:

没有答案
相关问题