protected static boolean verifyField(
     AbstractSession session, DatabaseField field, ClassDescriptor descriptor) {
   boolean ok = true;
   if (field.equals(descriptor.getSequenceNumberField())) {
     ok = false;
     session
         .getIntegrityChecker()
         .handleError(
             DescriptorException.returningPolicyFieldNotSupported(field.getName(), descriptor));
   } else if (descriptor.hasInheritance()
       && field.equals(descriptor.getInheritancePolicy().getClassIndicatorField())) {
     ok = false;
     session
         .getIntegrityChecker()
         .handleError(
             DescriptorException.returningPolicyFieldNotSupported(field.getName(), descriptor));
   } else if (descriptor.usesOptimisticLocking()) {
     OptimisticLockingPolicy optimisticLockingPolicy = descriptor.getOptimisticLockingPolicy();
     if (optimisticLockingPolicy instanceof VersionLockingPolicy) {
       VersionLockingPolicy versionLockingPolicy = (VersionLockingPolicy) optimisticLockingPolicy;
       if (field.equals(versionLockingPolicy.getWriteLockField())) {
         ok = false;
         session
             .getIntegrityChecker()
             .handleError(
                 DescriptorException.returningPolicyFieldNotSupported(
                     field.getName(), descriptor));
       }
     }
   }
   return ok;
 }
  /**
   * INTERNAL: Return the classification for the field contained in the mapping. This is used to
   * convert the row value to a consistent java value.
   */
  @Override
  public Class getFieldClassification(DatabaseField fieldToClassify) {
    if ((getTypeField() != null) && (fieldToClassify.equals(getTypeField()))) {
      return getTypeField().getType();
    }

    String queryKey = (String) getSourceToTargetQueryKeyNames().get(fieldToClassify);
    if (queryKey == null) {
      return null;
    }
    // Search any of the implementor descriptors for a mapping for the query-key.
    Iterator iterator =
        getReferenceDescriptor().getInterfacePolicy().getChildDescriptors().iterator();
    if (iterator.hasNext()) {
      ClassDescriptor firstChild = (ClassDescriptor) iterator.next();
      DatabaseMapping mapping = firstChild.getObjectBuilder().getMappingForAttributeName(queryKey);
      if ((mapping != null) && (mapping.isDirectToFieldMapping())) {
        return ((AbstractDirectMapping) mapping).getAttributeClassification();
      }
      QueryKey targetQueryKey = firstChild.getQueryKeyNamed(queryKey);
      if ((targetQueryKey != null) && (targetQueryKey.isDirectQueryKey())) {
        return firstChild
            .getObjectBuilder()
            .getFieldClassification(((DirectQueryKey) targetQueryKey).getField());
      }
    }
    return null;
  }