2019 Sep 12 7:53 AM - edited 2024 Feb 04 7:07 AM
I have created two items type and for these item type i have defined one to many relationship using Relation tag.How can i write impex for this relation?
Thanks and regards
preeti
sushma
Request clarification before answering.
I hope you should be able to write your ImpEx with the help of the following example:
<relation code="Country2RegionRelation" generate="true" localized="false" autocreate="true">
<sourceElement type="Country" qualifier="country" cardinality="one">
<modifiers read="true" write="true" search="true" optional="false" unique="true"/>
</sourceElement>
<targetElement type="Region" qualifier="regions" cardinality="many">
<modifiers read="true" write="true" search="true" partof="true"/>
</targetElement>
</relation>
<itemtype code="Country"
extends="C2LItem"
jaloclass="de.hybris.platform.jalo.c2l.Country"
autocreate="true"
generate="true">
<deployment table="Countries" typecode="34"/>
<attributes>
<attribute qualifier="isocode" type="java.lang.String" redeclare="true" generate="false">
<modifiers read="true" write="true" search="true" optional="false" unique="true"/>
</attribute>
</attributes>
</itemtype>
<itemtype code="Region"
extends="C2LItem"
jaloclass="de.hybris.platform.jalo.c2l.Region"
autocreate="true"
generate="true">
<deployment table="Regions" typecode="35"/>
<attributes>
<attribute autocreate="true" qualifier="country" type="Country">
<persistence type="property"/>
<modifiers read="true" write="true" search="true" optional="false" unique="true"/>
</attribute>
<attribute qualifier="isocode" type="java.lang.String" redeclare="true" generate="false">
<modifiers read="true" write="true" search="true" optional="false" unique="true"/>
</attribute>
</attributes>
<indexes>
<index name="Region_Country">
<key attribute="country"/>
</index>
</indexes>
</itemtype>ImpEx to insert data:
INSERT_UPDATE Country;isocode[unique=true]
;US
INSERT_UPDATE Region;country(isocode);isocode[unique=true]
;US;US-AL
;US;US-AK
;US;US-AZ
;US;US-AR
;US;US-CA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.