文档id引用不适用于impex

时间:2017-02-06 15:22:31

标签: sap hybris impex

我的impex存​​在问题,其中包含文档ID引用。

来自docs: “特别是对于导入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应该是什么样的。

3 个答案:

答案 0 :(得分:1)

使用partOf时,您必须使用所有者引用partOf

所以它确实:

INSERT B;owner(C.code);&docIdRef
;uniqueCode;docId

INSERT_UPDATE C;code[unique=true];test(&docIdRef)
;uniqueCode;docId

您无需为B分配标识符,只需要引用所有者。

答案 1 :(得分:0)

如果您确定数据是正确的,可以使用[forceWrite = true]修饰符或传统模式跳过服务层验证。

您还应确保此配置是您真正需要的。将optional设置为true或将partOf设置为false或提供默认值也可以解决问题。

答案 2 :(得分:0)

由于您提到partof="true",因此无法指定A类型的引用。您只能创建一个新实体。

检查OOTB AbstractOrder2AbstractOrderEntry关系,他们提到partof="true" AbstractOrderEntry表示您无法将任何其他AbstractOrderEntry引用到Order。您始终可以创建新条目。

同时查看HMC网站

enter image description here

您可以在此处看到此处没有+ Add Entry按钮。 可以实现倒数。

相关问题