The solution

Each class that implements Validator (which MyNewEntityImpl does via SingleTableEntityImpl) must implement standard methods for validation logic.

(Note that in general, implementation classes may implement Validator but that entity APIs should not extend Validator - you do not want calling code to be able to call validation methods directly.)

One of these Validator methods is mandatoryFieldValidation, where you must place any logic which detects whether any field value has not been set. It is up to your logic to determine how to detect whether or not a field value is "set" (typically with reference to the defaulted values of the generated Dtls struct).

The persistence infrastructure automatically calls mandatoryFieldValidation prior to any insert or modify operation (but not before a physical remove operation), and fails the operation if any validation errors have been raised. These errors include those raised by setter methods as well as by mandatoryFieldValidation. In particular, processing will not proceed to cross-field or cross-entity validation if any single-field or mandatory-field validation errors have been found.

Logic placed in mandatoryFieldValidation must consider each field on a field-by-field basis; logic which checks one field value against another must instead be placed in cross-field validation. In particular, the persistence infrastructure will prevent any database access occurring during mandatoryFieldValidation.

After analyzing requirements, you determine that in order to be valid your entity must always have the following specified:

You add the following code to implement mandatoryFieldValidation:

Figure 1. Implementing mandatory field validation logic
/**
   * {@inheritDoc}
   */
  public void mandatoryFieldValidation() {
    /*
     * Name cannot be empty
     */
    if (StringHelper.isEmpty(getDtls().name)) {
      ValidationHelper.addValidationError(
      MYNEWENTITYExceptionCreator
          .ERR_MY_NEW_ENTITY_FV_NAME_EMPTY());
    }

    /*
     * Start date must be specified
     */
    getDateRange().validateStarted();

    /*
     * Type must be specified
     */
    if (getType().equals(MYNEWENTITYTYPEEntry.NOT_SPECIFIED)) {
      ValidationHelper
          .addValidationError("Type must be specified");
    }

    /*
     * Parent entity instance must be specified
     */
    if (getMyParentEntity() == null) {
      ValidationHelper
          .addValidationError(
"Parent entity instance must be specified"
      );
    }

  }
Note that: