LLBLGen unique id contraint error while interchanging

Posts   
 
    
Posts: 1
Joined: 15-Aug-2018
# Posted on: 15-Aug-2018 14:26:15   

Hello, I have a unique key constraint with column (OrderNr,ClientNr) on table ClientOrders(Nr,OrderNr,ClientNr,Value,Date). from my forntent grid i am adding,deleting or modifying the values. for example: i have below scenario and getting an error for unique key constraint.

Nr--OrderNr--ClientNr--Value--Date 1--98--9001--1225--01.01.01 2--98--9002--1226--02.02.02

Here for example: i am deleting the second row and then again adding this row like below.

3--98--9002--1226--02.02.02

But while saving my entity then getting an error for Unique key constraint violation. Is it a known issue or it's a bug and how can i get rid of this scenario, don't tell me to disable my key constraint pls.

Thanks Sohel

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 15-Aug-2018 19:38:52   

don't tell me to disable my key constraint pls.

You have to disable the unique constraints.... kidding smile

First of all, when you delete from the grid, is the entity ever deleted from the database, I highly doubt that.

If you want to apply these in a single transaction you'd better using a UnitOfWork, and make sure the CommitOrder is set correctly, (deletes are executed first by default). http://www.llblgen.com/documentation/5.4/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/gencode_unitofwork_adapter.htm#specifying-the-order-in-which-the-actions-are-executed