Monday, April 12, 2010

Unique Key Validator on Entity does not work correctly

Unique Key Validator on Entity does not work correctly. Even if you have valid data in your entities, since it checks also database values it shows validation error.
Also after that in table components validations messages does not show after a refresh of browser, data change automatically to database values without showing an error.

For example in simple department Entity i create an alternative Key for DepartmentName to be unique.


Then i add an entity Unique Key Validation for this key:


I run a page with departments table and i create 2 departments
1 Dep1
2 Dep2


If i change department 1 name to dep2 then i correctly get the validation error:



But if i change department 2 to dep1 then i get unique validation errors even if both values in entities would be unique.


This could be logical for the developer since he knows that each row is validated seperately but not for the user.

Also if i refresh page in browser then if i do the same thing i dont get validation errors.
If i commit new values are not saved and database values are displayed back.


Is this working as expected?
Test Case:

3 comments: