[DEV] fix size error in string
This commit is contained in:
parent
dfc7c77f47
commit
058fb2e640
@ -129,7 +129,7 @@ public class AnnotationTools {
|
||||
return ((Min) annotation[0]).value();
|
||||
}
|
||||
|
||||
public static Integer getLimitSize(final Field element) throws Exception {
|
||||
public static int getLimitSize(final Field element) throws Exception {
|
||||
final Annotation[] annotation = element.getDeclaredAnnotationsByType(Column.class);
|
||||
if (annotation.length == 0) {
|
||||
return 255;
|
||||
@ -138,7 +138,7 @@ public class AnnotationTools {
|
||||
throw new Exception("Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
||||
}
|
||||
final int length = ((Column) annotation[0]).length();
|
||||
return length <= 0 ? null : length;
|
||||
return length <= 0 ? 0 : length;
|
||||
}
|
||||
|
||||
public static Size getConstraintsSize(final Field element) throws Exception {
|
||||
|
@ -131,7 +131,7 @@ public class DataFactory {
|
||||
public static void createTablesSpecificType(final String tableName, final Field elem, final StringBuilder mainTableBuilder, final List<String> preOtherTables, final List<String> postOtherTables,
|
||||
final boolean createIfNotExist, final boolean createDrop, final int fieldId, final Class<?> classModel) throws Exception {
|
||||
final String name = AnnotationTools.getFieldName(elem);
|
||||
final Integer limitSize = AnnotationTools.getLimitSize(elem);
|
||||
final int limitSize = AnnotationTools.getLimitSize(elem);
|
||||
final boolean notNull = AnnotationTools.getColumnNotNull(elem);
|
||||
|
||||
final boolean primaryKey = AnnotationTools.isPrimaryKey(elem);
|
||||
@ -152,7 +152,7 @@ public class DataFactory {
|
||||
String typeValue = null;
|
||||
typeValue = convertTypeInSQL(classModel, name);
|
||||
if ("text".equals(typeValue) && !"sqlite".equals(ConfigBaseVariable.getDBType())) {
|
||||
if (limitSize != null) {
|
||||
if (limitSize > 0) {
|
||||
mainTableBuilder.append("varchar(");
|
||||
mainTableBuilder.append(limitSize);
|
||||
mainTableBuilder.append(")");
|
||||
|
Loading…
x
Reference in New Issue
Block a user