无法为我在代码 (hybris) 上创建的作业导入 impex

Can not import on impex for the job i created on code (hybris)

我遵循了那个教程https://www.stackextend.com/hybris/everything-about-cronjobs-in-hybris-part-2/

但我使用的不是字符串,而是 customerlist 参数。像那样:

    <attribute qualifier="customers" type="CustomersList">
                <modifiers read="true" write="true" initial="false" optional="true" partof="true"/>
                <persistence type="jalo"/>//i changed this to  dynamic, because jalo gives error
            </attribute>

我在

中定义的
 <collectiontype code="CustomersList" elementtype="Customer" autocreate="true" generate="true" type="list"/>

在教程的底部,它说导入那些

INSERT_UPDATE ServicelayerJob   ;code[unique=true]  ;springId


INSERT_UPDATE HelloWorldCronJob ;code[unique=true]  ;job(code)      ;firstName
                                ;helloWorldCronJob  ;helloWorldJob  ;Mouad

我先导入成功了

但是对于第二个,我应该改变,因为我不再有那个名字区域了。我将其更改为客户列表,所以我应该使用其他东西。我也试着让它为空,但错误总是一样的:

,,,,line 2: cannot create UsersFindCronJob with values ItemAttributeMap[ registry: null, type: , data: {code=usersFindCronJob, job=usersFindJob(8796094628340)} ] due to cannot find spring bean [UsersFindCronJob_customersAttributeHandler] configured for dynamic attribute [UsersFindCronJob.customers] from extension [trainingcore], line 3: cannot create UsersFindCronJob with values ItemAttributeMap[ registry: null, type: , data: {code=usersFindCronJob, job=usersFindJob(8796094628340)} ] due to cannot find spring bean [UsersFindCronJob_customersAttributeHandler] configured for dynamic attribute [UsersFindCronJob.customers] from extension [trainingcore];usersFindCronJob;usersFindJob;Zohan

出现错误的示例导入:

INSERT_UPDATE UsersFindCronJob;code[unique=true];job(code);customers
;usersFindCronJob;usersFindJob;testcustomerbutthisisnotcustomerthisisstring

我该怎么办?

如果持久化类型是动态的:

<persistence type="dynamic"/>

然后你需要创建一个Spring bean,它应该负责根据其他持久属性计算动态值

动态属性的一个示例可以是客户的全名, 可以通过像这样连接来计算: firstname + lastname 其中 firstnamelastname 是数据库中存储的两个属性(持久化类型="property")

如果您希望将您的属性存储在数据库中(我相信这是指定的),那么您应该将持久性类型设置为 属性 而不是动态:

<persistence type="property"/>

集合类型已弃用。更喜欢关系。

<relations>
    <relation code="UsersFindCronJob2CustomerRelation" localized="false" >
        <sourceElement type="UsersFindCronJob" cardinality="many" qualifier="usersFindCronJob" />
        <targetElement type="Customer" cardinality="many" qualifier="customer" />
    </relation>
</relations>

然后您可以像这样导入一个 cronjob:

INSERT_UPDATE UsersFindCronJob;code[unique=true];job(code);customer(uid)
;usersFindCronJob;usersFindJob;myCustomerUid1, myCustomerUid2, myCustomerUid3