3

我有两张桌子,price_feedprice_feed_type。价格馈送将包含价格馈送的不同实现的数据。

现在,这通常是通过<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

一个额外的注释,没有括号,我得到了错误:

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 "."
4

0 回答 0