Item
具有
属性集合
地图
name
,
locale
和
value
)
一笔费用
映射:
<map table="ITEM_ATTRIBUTES" name="attributes">
<key column="item_id" foreign-key="fk_itmr_attrbts_itmrs"/>
<composite-index class="LocalizedKey">
<key-property name="name" column="name"/>
<key-property name="locale" column="locale" length="32"/>
</composite-index>
<element column="value" type="escapedString" not-null="true"/>
</map>
这个HQL(带有
:key
LocalizedKey
和
:value
作为
String
from Item item
where item.attributes[:key] = :value
无法工作并产生以下输出
error: composite-index appears in []
我在查询中使用纯SQL创建了一个解决方案。但我想知道
.
select i.* from items i
left join item_attributes a on a.item_id = i.id
where a.name = :name
and a.locale = :locale
and a.value = :value