fix uniqueness validation problem with inheritance

switch the class to create criteria for uniqueness validation when the field is defined in ancestor class.
[ fix #2783 ]