added constraints in the entities class