2019 Mar 16 12:39 PM - edited 2024 Feb 04 6:14 AM
Hi experts, I'm facing this issue when defining my custom canonical type in datahub v6.3.
I'm getting MissingReferenceException:
Caused by: com.hybris.datahub.service.spel.MissingReferenceException: No reference canonical item found with a type: CanonicalCustomField, and conditions: [partyId=0000045733_KNVK, customField=ZPRICECALL]
at com.hybris.datahub.service.spel.impl.DefaultItemResolver.resolveReference(DefaultItemResolver.java:82) ~[datahub-service-6.3.0.6-RC2.jar:6.3.0.6-RC2]
at com.hybris.datahub.service.spel.impl.DefaultItemResolver.resolve(DefaultItemResolver.java:56) ~[datahub-service-6.3.0.6-RC2.jar:6.3.0.6-RC2]
at com.hybris.datahub.service.spel.impl.ResolveMethodExecutor.execute(ResolveMethodExecutor.java:48) ~[datahub-service-6.3.0.6-RC2.jar:6.3.0.6-RC2]
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:85) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:120) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:242) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE]
at com.hybris.datahub.service.spel.impl.CompilableSpelExpressionProcessor.transform(CompilableSpelExpressionProcessor.java:88) ~[datahub-service-6.3.0.6-RC2.jar:6.3.0.6-RC2]
... 43 common frames omitted
I can't figure out what am I doing wrong. I have defined meta data as the follow.
Raw:
<item>
<type>CanonicalCustomField</type>
<attributes>
<attribute>
<name>partyId</name>
<transformations>
<transformation>
<rawSource>RawDEBMAS</rawSource>
<expression>E1KNA1M-KUNNR</expression>
</transformation>
</transformations>
</attribute>
<attribute>
<name>customField</name>
<transformations>
<transformation>
<rawSource>RawDEBMAS</rawSource>
<expression>E1KNA1M-ZKNA1-ZZFIELD</expression>
</transformation>
</transformations>
</attribute>
<attribute>
<name>customValue</name>
<transformations>
<transformation>
<rawSource>RawDEBMAS</rawSource>
<expression>E1KNA1M-ZKNA1-ZZVALUE</expression>
</transformation>
</transformations>
</attribute>
</attributes>
</item>
Canonical:
<item>
<type>CanonicalCustomField</type>
<attributes>
<attribute>
<name>partyId</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>true</primaryKey>
</model>
</attribute>
<attribute>
<name>customField</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>true</primaryKey>
</model>
</attribute>
<attribute>
<name>customValue</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>false</primaryKey>
</model>
</attribute>
</attributes>
</item>
Target:
<item>
<type>ContactPerson</type>
<exportCode>B2BCustomer</exportCode>
<description>Contact person for the company.</description>
<updatable>true</updatable>
<canonicalItemSource>CanonicalPartyRelationship</canonicalItemSource>
<status>ACTIVE</status>
<dependencies>
<dependency>Company</dependency>
<dependency>CompanyAddress</dependency>
<dependency>CompanySalesUnit</dependency>
<dependency>CompanySalesUnitAddress</dependency>
</dependencies>
<attributes>
...........
<attribute>
<name>disableCachePrice</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>
resolve('CanonicalCustomField', 'SAPCUSTOMER_INBOUND_POOL', 'partyId='+#root.relatedPartyId, 'customField=ZPRICECALL')
</transformationExpression>
<exportCode>disableCachePrice</exportCode>
</attribute>
</attributes>
</item>
I checked MySql and the new type is not generated on DB. Any help would be really appreciate. Thank you!
Request clarification before answering.
Hi Slava, thank you for your answer.
Actually, the item was never composed because Datahub seems to not handle custom types other than the standard ones defined in the party-canonical extension of Hybris. So, I wrote a custom CompositionHandler to load these segments in a standard CanonicalItem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Simone,
1) DataHub does not generate a table per new type. You can find your types created in RawItemMeta, CanonicalItemMeta and TargetItemMeta tables.
2) The error message is complaining that it's searching for CanonicalCustomField item with attribute values [partyId=0000045733_KNVK, customField=ZPRICECALL] in SAPCUSTOMER_INBOUND_POOL and does not find such item. Most likely such item was never loaded into RawItem; or it was never composed into CanonicalItem; or it exists but not in the SAPCUSOMTER_INBOUND_POOL. Check those conditions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.