2019 Jan 17 2:09 PM - edited 2024 Feb 03 5:26 PM
Hi Experts,
I had created REGION_NAME attribute as false previously in datahub canonical and target models. Then I changed localizable property to true as below code snippet.
canonical.xml content:
<attributes>
<attribute>
<name>REGION_CODE</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>true</primaryKey>
</model>
</attribute>
<attribute>
<name>REGION_NAME</name>
<model>
<localizable>true</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>false</primaryKey>
</model>
</attribute>
<attribute>
<name>COUNTRY_CODE</name>
<model>
<localizable>false</localizable>
<collection>false</collection>
<type>String</type>
<primaryKey>false</primaryKey>
</model>
</attribute>
</attributes>
target.xml content:
<exportCode>Region</exportCode>
<description>Hybris Platform representation of region</description>
<updatable>true</updatable>
<canonicalItemSource>CanonicalRegion</canonicalItemSource>
<status>ACTIVE</status>
<attributes>
<attribute>
<name>REGION_CODE</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>REGION_CODE</transformationExpression>
<exportCode>isocode[unique=true]</exportCode>
<mandatoryInHeader>true</mandatoryInHeader>
</attribute>
<attribute>
<name>REGION_NAME</name>
<localizable>true</localizable>
<collection>false</collection>
<transformationExpression>REGION_NAME</transformationExpression>
<exportCode>name</exportCode>
<mandatoryInHeader>false</mandatoryInHeader>
</attribute>
<attribute>
<name>COUNTRY_CODE</name>
<localizable>false</localizable>
<collection>false</collection>
<transformationExpression>COUNTRY_CODE</transformationExpression>
<exportCode>country(isocode)</exportCode>
<mandatoryInHeader>false</mandatoryInHeader>
</attribute>
</attributes>
But it seems that the structure of datahub items remains the same as I am getting below error. I have tried using datahub.autoInitMode=create-drop in locale.properties file and restarted the server but still getting same error. It seems there is some caching done at datahub end or the database schemes are not getting deleted. Can someone help me figure out that?
Error Log:
java.lang.IllegalArgumentException: Attribute Region.REGION_NAME cannot set a value of type HashMap at com.google.common.base.Preconditions.checkArgument(Preconditions.java:148) at com.hybris.datahub.model.BaseDataItem.validateAttributeValueType(BaseDataItem.java:307) at com.hybris.datahub.model.BaseDataItem.setField(BaseDataItem.java:105) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.populateAttributeFromCanonicalItem(DefaultCanonicalToTargetItemConverterService.java:102) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.lambda$populateTargetItem$0(DefaultCanonicalToTargetItemConverterService.java:89) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1548) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.populateTargetItem(DefaultCanonicalToTargetItemConverterService.java:89) at com.hybris.datahub.service.publication.impl.DefaultCanonicalToTargetItemConverterService.convert(DefaultCanonicalToTargetItemConverterService.java:60) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Request clarification before answering.
| User | Count |
|---|---|
| 1 | |
| 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.