added checked exception for constraint violations and entity not found.