Program: 43464
Project: 43464
Buggy source:
private EntityField evalField(DatabaseMeta db,ResultSetMetaData rsmd,Entity<?> entity,Field field) throws SQLException {
  field.setAccessible(true);
  EntityField ef=new EntityField(entity,field);
  Column column=field.getAnnotation(Column.class);
  if (null == column || Strings.isBlank(column.value()))   ef.setColumnName(field.getName());
 else   ef.setColumnName(column.value());
  int ci=Daos.getColumnIndex(rsmd,ef.getColumnName());
  ef.setReadonly((field.getAnnotation(Readonly.class) != null));
  if (null != rsmd)   ef.setNotNull(ResultSetMetaData.columnNoNulls == rsmd.isNullable(ci));
  if (null != rsmd)   if (ef.getMirror().isEnum()) {
    if (Daos.isIntLikeColumn(rsmd,ci))     ef.setType(FieldType.ENUM_INT);
  }
  Default dft=field.getAnnotation(Default.class);
  if (null != dft) {
    ef.setDefaultValue(new CharSegment(dft.value()));
  }
  Prev prev=field.getAnnotation(Prev.class);
  if (null != prev) {
    ef.setBeforeInsert(FieldQuerys.eval(db,prev.value(),ef));
  }
  Next next=field.getAnnotation(Next.class);
  if (null != next) {
    ef.setAfterInsert(FieldQuerys.eval(db,next.value(),ef));
  }
  Id id=field.getAnnotation(Id.class);
  if (null != id) {
    if (!ef.getMirror().isIntLike())     throw error(entity,"String_Node_Str",field.getName());
    if (id.auto()) {
      ef.setType(FieldType.SERIAL);
      if (null == field.getAnnotation(Next.class)) {
        ef.setAfterInsert(FieldQuerys.create("String_Node_Str",ef));
      }
    }
 else {
      ef.setType(FieldType.ID);
    }
  }
  Name name=field.getAnnotation(Name.class);
  if (null != name) {
    if (!ef.getMirror().isStringLike())     throw error(entity,"String_Node_Str",field.getName());
    ef.setNotNull(true);
    if (name.casesensitive())     ef.setType(FieldType.CASESENSITIVE_NAME);
 else     ef.setType(FieldType.NAME);
  }
  ef.setFieldAdapter(FieldAdapter.create(ef.getMirror(),ef.isEnumInt()));
  ef.setValueAdapter(ValueAdapter.create(ef.getMirror(),ef.isEnumInt()));
  return ef;
}

Fixed version (ground truth):
protected EntityField evalField(DatabaseMeta db,ResultSetMetaData rsmd,Entity<?> entity,Field field) throws SQLException {
  field.setAccessible(true);
  EntityField ef=new EntityField(entity,field);
  Column column=field.getAnnotation(Column.class);
  if (null == column || Strings.isBlank(column.value()))   ef.setColumnName(field.getName());
 else   ef.setColumnName(column.value());
  int ci=Daos.getColumnIndex(rsmd,ef.getColumnName());
  ef.setReadonly((field.getAnnotation(Readonly.class) != null));
  if (null != rsmd)   ef.setNotNull(ResultSetMetaData.columnNoNulls == rsmd.isNullable(ci));
  if (null != rsmd)   if (ef.getMirror().isEnum()) {
    if (Daos.isIntLikeColumn(rsmd,ci))     ef.setType(FieldType.ENUM_INT);
  }
  Default dft=field.getAnnotation(Default.class);
  if (null != dft) {
    ef.setDefaultValue(new CharSegment(dft.value()));
  }
  Prev prev=field.getAnnotation(Prev.class);
  if (null != prev) {
    ef.setBeforeInsert(FieldQuerys.eval(db,prev.value(),ef));
  }
  Next next=field.getAnnotation(Next.class);
  if (null != next) {
    ef.setAfterInsert(FieldQuerys.eval(db,next.value(),ef));
  }
  Id id=field.getAnnotation(Id.class);
  if (null != id) {
    if (!ef.getMirror().isIntLike())     throw error(entity,"String_Node_Str",field.getName());
    if (id.auto()) {
      ef.setType(FieldType.SERIAL);
      if (null == field.getAnnotation(Next.class)) {
        ef.setAfterInsert(FieldQuerys.create("String_Node_Str",ef));
      }
    }
 else {
      ef.setType(FieldType.ID);
    }
  }
  Name name=field.getAnnotation(Name.class);
  if (null != name) {
    if (!ef.getMirror().isStringLike())     throw error(entity,"String_Node_Str",field.getName());
    ef.setNotNull(true);
    if (name.casesensitive())     ef.setType(FieldType.CASESENSITIVE_NAME);
 else     ef.setType(FieldType.NAME);
  }
  ef.setFieldAdapter(FieldAdapter.create(ef.getMirror(),ef.isEnumInt()));
  ef.setValueAdapter(ValueAdapter.create(ef.getMirror(),ef.isEnumInt()));
  return ef;
}