mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#439 - @EnumValue("01") stored as integer rather than string - ENum stores strings as numerics?
This commit is contained in:
@@ -419,8 +419,10 @@ public final class DefaultTypeManager implements TypeManager, KnownImmutable {
|
||||
return value;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
private boolean isIntegerType(String s) {
|
||||
protected boolean isIntegerType(String s) {
|
||||
if (isLeadingZeros(s)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
Integer.parseInt(s);
|
||||
return true;
|
||||
@@ -429,6 +431,13 @@ public final class DefaultTypeManager implements TypeManager, KnownImmutable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Treat leading zeros as a non-integer for enum values.
|
||||
*/
|
||||
private boolean isLeadingZeros(String s) {
|
||||
return s.length() > 1 && s.charAt(0) == '0';
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the Mapping of Enum fields to DB values using EnumValue annotations.
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user