wrote:
Neha,
Doesn't matter.
If you violate the unique index when changing an existing record, it will trigger an exception.
Using the examples given above, but now with an UPDATE instead of an INSERT.
MyEntity
id - Name - Age
1 - Joao - 21
2 - Maria - 22
a) Index UNIQUE for Column Name
If I try to change (Joao, 21) to (Maria, 21) -> FAIL, because there is already a record (id 2) in the database with name Maria
b) Index UNIQUE for columns Name AND Age (in the same index)
if I try to change (Joao, 21) to (Maria, 22) -> Fail, because there is a record (id 2) with both values.
Cheers.
But I have only 2 record, My unique index is Year and RecordDate
Id Year RecordDate isLocked
1 2017 CurrentDateTime false
2 2018 CurrentDateTime false
GetRecordforUpdateById(2) update isLocked to true, and save
This gives me the above exception.