mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-24 01:44:38 +00:00
Possible fix error with multiple uses of enum (#1473)
When an enum is exists in the type cache and isn't String, @DbArray fails. This includes a test that should fail everywhere (order of reading fields isn't guaranteed afaik and the column needs to be read before the @DbArray for the test to fail).
This commit is contained in:
@@ -351,7 +351,7 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
if (type.equals(List.class)) {
|
||||
if (arrayTypeListFactory != null) {
|
||||
if (isEnumType(valueType)) {
|
||||
return arrayTypeListFactory.typeForEnum(createEnumScalarType(asEnumClass(valueType), EnumType.STRING));
|
||||
return arrayTypeListFactory.typeForEnum(createEnumScalarType(asEnumClass(valueType), null));
|
||||
}
|
||||
return arrayTypeListFactory.typeFor(valueType);
|
||||
}
|
||||
@@ -360,7 +360,7 @@ public final class DefaultTypeManager implements TypeManager {
|
||||
} else if (type.equals(Set.class)) {
|
||||
if (arrayTypeSetFactory != null) {
|
||||
if (isEnumType(valueType)) {
|
||||
return arrayTypeSetFactory.typeForEnum(createEnumScalarType(asEnumClass(valueType), EnumType.STRING));
|
||||
return arrayTypeSetFactory.typeForEnum(createEnumScalarType(asEnumClass(valueType), null));
|
||||
}
|
||||
return arrayTypeSetFactory.typeFor(valueType);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ public class EArrayBean {
|
||||
ONE, TWO, THREE
|
||||
}
|
||||
|
||||
IntEnum foo;
|
||||
|
||||
@Id
|
||||
Long id;
|
||||
|
||||
@@ -50,6 +52,14 @@ public class EArrayBean {
|
||||
@Version
|
||||
Long version;
|
||||
|
||||
public IntEnum getFoo() {
|
||||
return foo;
|
||||
}
|
||||
|
||||
public void setFoo(final IntEnum foo) {
|
||||
this.foo = foo;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user