Quantcast
Channel: OutSystems Community
Viewing all articles
Browse latest Browse all 1476385

[Forums] Database exception

$
0
0

Eduardo Jauch 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.



Viewing all articles
Browse latest Browse all 1476385

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>