Skip to Content
0
Jul 17, 2020 at 02:31 AM

Update OOTB 'relation'

154 Views

I'm looking at updating an OOTB 'relation', just wanted to add 'ordered=true'.

OOTB

\hybris\bin\modules\commerce-services\commerceservices\resources\commerceservices-items.xml

<relation code="PoS2WarehouseRel" localized="false"
			generate="true" autocreate="true">
<description>This relation determines available warehouses for the point of service.</description>
<deployment table="PoS2WarehouseRel" typecode="6217" />
       <sourceElement qualifier="pointsOfService" type="PointOfService"
				cardinality="many" />
	<targetElement qualifier="warehouses" type="Warehouse"
				cardinality="many" collectiontype="list" />				
</relation>

In my extension core, myextncore-items.xml, I overwrote the OOTB relation,

<!-- Set autocreate="false" and added ordered="true" in the 'targetElement' -->

<relation code="PoS2WarehouseRel" localized="false"
				  generate="true" autocreate="false">
<description>This relation determines available warehouses for the point of service.</description>
<sourceElement qualifier="pointsOfService" type="PointOfService"
						   cardinality="many" />
<targetElement qualifier="warehouses" type="Warehouse"
				cardinality="many" collectiontype="list" ordered="true"/>
</relation><br>

But getting error - [ycheckdeployments] No deployment defined for relation PoS2WarehouseRel

Updated to a new code name, added a 'deployment' element,

<relation code="PoS2WarehouseRelNew" localized="false"
				  generate="true" autocreate="true">
<description>This relation determines available warehouses for the point of service.</description>
	<deployment table="PoS2WarehouseRelNew" typecode="13000" />
	<sourceElement qualifier="pointsOfService" type="PointOfService"
						   cardinality="many" />
	<targetElement qualifier="warehouses" type="Warehouse"
				cardinality="many" collectiontype="list" ordered="true"/>
</relation><br>

This time getting error - java.lang.UnsupportedOperationException: Attribute warehouses from PoS2WarehouseRelNew relation is already declared in Warehouse

How do I define a relation between 'pointsOfService' and 'warehouses' ?