validators and unique fields

Hello!

spring Validators like for example the one for ConceptSource checks fields lengths and that required fields are filled but does not check that for example ConceptSource.name or hl7Code might already exist (they have unique constraints).

This leads to the user seeing a HibernateException (at least in the legacyui).

Would it be a good idea to add the DAO to the validator and check if that name already exists, so the user gets a nice message telling him a ConceptSource with that name already exists?

+1 for validating unique constraints

I’m assuming it can be done case insensitive, doesn’t affect performance, and any db access is in the DAO layer, as you suggest.

Ideally the search would be accent insensitive as well; however, I think the approach of this might vary from one type of db to another (e.g., we may get it for free with a MySQL collation, but not with Postgres).