mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Update ScalarTypeEnumStandard.java
Using toString() to calculate the Enum length is wrong. If you overwrite the Enum's toString() the length may be shorter. In this situation, the ddl script will create a to small varchar field for the value and you get an exception on save
This commit is contained in:
@@ -66,7 +66,7 @@ public class ScalarTypeEnumStandard {
|
||||
Object[] ea = enumType.getEnumConstants();
|
||||
for (int i = 0; i < ea.length; i++) {
|
||||
Enum<?> e = (Enum<?>) ea[i];
|
||||
maxLen = Math.max(maxLen, e.toString().length());
|
||||
maxLen = Math.max(maxLen, e.name().length());
|
||||
}
|
||||
|
||||
return maxLen;
|
||||
|
||||
Reference in New Issue
Block a user