我对impex有一个问题,它包含文档id引用。
来自文档:“特别是对于导入partOf项值,有必要通过通常的唯一列技术以外的方法引用这些项,因为partOf项通常不提供唯一键,而只是将其封闭的父项作为外键。”
来自*items.xml的项目(仅限最重要的部分)
<itemtype code="A" autocreate="true" generate="true" abstract="true"/>
<itemtype code="B" autocreate="true" generate="true" extends="A">
<deployment table="btable" typecode="20115" />
<attributes>
<attribute qualifier="code" type="java.lang.Integer" autocreate="true" generate="true">
<persistence type="property"/>
<modifiers optional="false"/>
</attribute>
</attributes>
</itemtype>
<itemtype code="C" autocreate="true" generate="true">
<deployment table="ctable" typecode="20117" />
<attributes>
<attribute qualifier="code" type="java.lang.String" autocreate="true" generate="true">
<persistence type="property"/>
<modifiers optional="false" unique="true"/>
</attribute>
<attribute qualifier="test" type="A" autocreate="true" generate="true">
<persistence type="property"/>
<modifiers optional="false" partof="true"/>
</attribute>
</attributes>
</itemtype>Impex代码:
INSERT B;code;&docIdRef
;1;docId
INSERT_UPDATE C;code[unique=true];test(&docIdRef)
;uniqueCode;docId错误消息:
cannot create C with values ItemAttributeMap[ registry: null, type: <null>, (...) due to [de.hybris.platform.servicelayer.interceptor.impl.MandatoryAttributesValidator@3b777877]:missing values for [test] in model C当我从'test‘属性(C类)中删除'partof’修饰符时,一切都运行得很好。
我想知道如果我想保留'partof‘修饰符,impex应该是什么样子的。
发布于 2017-02-07 17:03:54
使用partOf时,必须使用所有者引用partOf。
它确实是这样的:
INSERT B;owner(C.code);&docIdRef
;uniqueCode;docId
INSERT_UPDATE C;code[unique=true];test(&docIdRef)
;uniqueCode;docId您不需要为B分配标识符,只需引用所有者即可。
发布于 2017-02-07 01:53:50
如果您确信数据是正确的,那么可以使用forceWrite=true修饰符或遗留模式跳过服务层验证。
您还应该确保此配置是您真正需要的。将optional设置为true或将partOf设置为false或提供默认值也可以解决此问题。
发布于 2017-02-07 13:18:55
因为您已经提到了partof="true",所以不能分配A类型的引用。您只能创建新实体。
检查OOTB的AbstractOrder2AbstractOrderEntry关系,他们提到了AbstractOrderEntry的partof="true",这意味着你不能将任何其他AbstractOrderEntry引用到Order。您可以随时创建新条目。
您还可以查看HMC网站

您可以看到这里没有可用的+ Add Entry按钮。倒数是可以实现的。
https://stackoverflow.com/questions/42071293
复制相似问题