hibernate section 5.1.3末尾的示例没有显示传递参数的示例。
There is no difference between a view and a base table for a Hibernate mapping. This is transparent at the database level, although some DBMS do not support views properly, especially with updates. Sometimes you want to use a view, but you cannot create one in the database (i.e. with a legacy schema). In this case, you can map an immutable and read-only entity to a given SQL subselect expression:
<class name="Summary">
<subselect>
select item.name, max(bid.amount), count(*)
from item
join bid on bid.item_id = item.id
group by item.name
</subselect>
<synchronize table="item"/>
<synchronize table="bid"/>
<id name="name"/>
...
</class>
这可能吗?如果是这样,怎么办?
谢谢, 弗兰兹
最佳答案
我认为这是不可能的,因为映射文件就像一个静态描述。
关于java - 如何将参数传递给 Hibernate 的 subselect 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1253729/