update entity by adding constraint validation and adding unit test for getter and setter