This commit is contained in:
jamesagnew 2021-01-05 18:41:43 -05:00
parent 0bb878e4a8
commit 496a8bd3cd
1 changed files with 11 additions and 4 deletions

View File

@ -194,13 +194,20 @@ public class TestUtil {
hasEmbeddedId ||
isField, "Non-transient has no @Column or @JoinColumn or @EmbeddedId: " + nextField);
int columnLength = 16;
String columnName = null;
if (hasColumn) {
String columnName = nextField.getAnnotation(Column.class).name();
int columnLength = nextField.getAnnotation(Column.class).length();
columnName = nextField.getAnnotation(Column.class).name();
columnLength = nextField.getAnnotation(Column.class).length();
}
if (hasJoinColumn) {
columnName = nextField.getAnnotation(JoinColumn.class).name();
}
if (columnName != null) {
if (nextField.getType().isAssignableFrom(String.class)) {
// MySQL treats each char as the max possible byte count in UTF-8 for its calculations
columnLength = columnLength * 4;
} else {
columnLength = 16;
}
columnNameToLength.put(columnName, columnLength);