If you require logic to prevent modifications to the entity if it is in an inappropriate state, then you must override your entity's modify method:
/**
* {@inheritDoc}
*/
@Override
public void modify(Integer versionNo)
throws InformationalException {
if (!getState().isModifyAllowed()) {
ValidationHelper
.addValidationError(
"You are not allowed to modify this record when it is in this state"
);
}
super.modify(versionNo);
}