rzo1 commented on code in PR #144:
URL: https://github.com/apache/openjpa/pull/144#discussion_r3802493033
##########
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/EnumValueHandler.java:
##########
@@ -116,8 +219,26 @@ public Object toDataStoreValue(ValueMapping vm, Object
val, JDBCStore store) {
public Object toObjectValue(ValueMapping vm, Object val) {
if (val == null)
return null;
- if (_ordinal)
- return _vals[((Number) val).intValue()];
- return Enum.valueOf(vm.getType(), (String) val);
+ if (_useEnumeratedValue) {
+ initEnumeratedValueField(vm.getType());
+ Enum<?> result = _dbToEnum.get(val);
+ if (result == null && val instanceof Number) {
+ result = _dbToEnum.get(((Number) val).intValue());
+ }
+ if (result == null) {
+ result = _dbToEnum.get(val.toString());
+ }
+ return result;
Review Comment:
I'll have a look at this comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]