是否可以通过items.xml在Hybris中创建复合唯一键?
在给定的示例中:
<itemtype code="SimpleDevice">
<deployment table="simpleDevice" typecode="20063"/>
<attributes>
<attribute qualifier="productId" type="java.lang.String">
<persistence type="property" />
<modifiers unique="true" optional="false" initial="true"/>
<description>Device's product ID</description>
</attribute>
<attribute qualifier="serialNumber" type="java.lang.String">
<persistence type="property" />
<modifiers unique="true" optional="false" initial="true"/>
<description>Device's serial number</description>
</attribute>
</attributes>
</itemtype>
如何结合2属性以使其表现为复合唯一键?我的计划B是使用一些拦截器在创建它之前检查这种组合是否已经存在。但是我想避免在通过Impex导入多个项目时使数据库过载。
给定的例子已经是正确的。它使productId和serialNumber的组合唯一。