cancel
Showing results for 
Search instead for 
Did you mean: 

Ambiguous unique keys exception when changing Product in OrderEntry

Former Member
0 Kudos

Here is my impex content to update product code in order entry

INSERT_UPDATE OrderEntry;order(code)[unique=true];entryNumber[unique=true];product(code ,catalogVersion(catalog(id[default=xxcProductCatalog])version[default=Online]))[unique=true];quantity;unit(code);namedDeliveryDate[dateformat=yyyyMMdd];estimatedGrossPrice;estimatedItemTotal;totalPrice;scheduledDate[dateformat=yyyyMMdd];deliveryNote;certificateOfAnalysis;invoices(code);plant(UID); **;A_0001319965;00010;A_000000000000200005;**25000.000;KG;20160817;0.00;0.00;0.00;20160716;;;;A_A020;

i am trying to update the product code "A_000000000000200009" with "A_000000000000200005" , i am getting the following exception

18.08.2016 10:15:28: ERROR: line 2 at main script: line 2: cannot create OrderEntry with values ItemAttributeMap[ registry: null, type: , data: {product=Product 'A_000000000000200009' (8796093415425), unit=Unit 'KG' type 'weight' (8796096462858), totalprice=0.0, order=A_0001319965(8796093251629), estimateditemtotal=0.0, nameddeliverydate=Wed Aug 17 00:00:00 CEST 2016, deliverynote=null, scheduleddate=Sat Jul 16 00:00:00 CEST 2016, certificateofanalysis=null, entrynumber=10, estimatedgrossprice=0.0, plant=A_A020[8796127428613], quantity=25000, invoices=[]} ] due to [de.hybris.platform.servicelayer.interceptor.impl.UniqueAttributesInterceptor@6a041ccc]:ambiguous unique keys {entryNumber=10, order=OrderModel (8796093251629)} for model OrderEntryModel () - found 1 item(s) using the same keys 18.08.2016 10:15:28: ERROR: line 2 at main script: Exception 'line 2: cannot create OrderEntry with values ItemAttributeMap[ registry: null, type: , data: {product=Product 'A_000000000000200009' (8796093415425), unit=Unit 'KG' type 'weight' (8796096462858), totalprice=0.0, order=A_0001319965(8796093251629), estimateditemtotal=0.0, nameddeliverydate=Wed Aug 17 00:00:00 CEST 2016, deliverynote=null, scheduleddate=Sat Jul 16 00:00:00 CEST 2016, certificateofanalysis=null, entrynumber=10, estimatedgrossprice=0.0, plant=A_A020[8796127428613], quantity=25000, invoices=[]} ] due to [de.hybris.platform.servicelayer.interceptor.impl.UniqueAttributesInterceptor@6a041ccc]:ambiguous unique keys {entryNumber=10, order=OrderModel (8796093251629)} for model OrderEntryModel () - found 1 item(s) using the same keys' in handling exception: line 2: cannot create OrderEntry with values ItemAttributeMap[ registry: null, type: , data: {product=Product 'A_000000000000200009' (8796093415425), unit=Unit 'KG' type 'weight' (8796096462858), totalprice=0.0, order=A_0001319965(8796093251629), estimateditemtotal=0.0, nameddeliverydate=Wed Aug 17 00:00:00 CEST 2016, deliverynote=null, scheduleddate=Sat Jul 16 00:00:00 CEST 2016, certificateofanalysis=null, entrynumber=10, estimatedgrossprice=0.0, plant=A_A020[8796127428613], quantity=25000, invoices=[]} ] due to [de.hybris.platform.servicelayer.interceptor.impl.UniqueAttributesInterceptor@6a041ccc]:ambiguous unique keys {entryNumber=10, order=OrderModel (8796093251629)} for model OrderEntryModel () - found 1 item(s) using the same keys

The same update when tried to hMC its working, Can any one suggest how do i update product code if the OrderNumber and EntryNumber are unique for a particular order?

Thanks Sebin

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You should not define the product as unique.

INSERT_UPDATE OrderEntry;order(code)[unique=true];entryNumber[unique=true];product(code ,catalogVersion(catalog(id[default=xxcProductCatalog])version[default=Online]));quantity;unit(code);namedDeliveryDate[dateformat=yyyyMMdd];estimatedGrossPrice;estimatedItemTotal;totalPrice;scheduledDate[dateformat=yyyyMMdd];deliveryNote;certificateOfAnalysis;invoices(code);plant(UID);

Cheers

Former Member
0 Kudos

Juan Thanks for the response , here Order code and Entry Number is only set unique , product isn't unique...

Former Member
0 Kudos

Hi,

In your post product is set as unique. I copy your impex header removing the unique restriction on the product attribute.

Best, Juanma

Former Member
0 Kudos

Thanks Juan it worked ..Great i missed to notice it.