add constraints to domain classes