我有课货
<class name="Goods">
...
<map name="names" lazy="false" fetch="join">
<key not-null="true" />
<map-key column="LANGUAGE_CODE" type="language" length="2"/>
<composite-element class="Goods$Names">
<property name="name" not-null="true" type="text"/>
<property name="description" type="text"/>
</composite-element>
</map>
...
</class>
当我尝试像这样按名称搜索商品时出现问题:
session.createQuery("select g from Goods g where g.names[:lang].name = 'Some goods name'")
javax.servlet.ServletException: java.lang.IllegalArgumentException: Cannot create element join for a collection of non-entities!
用Hibernate真的不可能吗?
我真的需要将商品名称设为具有自己 ID 的实体吗?有什么解决办法吗?