rzo1 commented on code in PR #226:
URL: https://github.com/apache/openjpa/pull/226#discussion_r4376734747
##########
openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractPCData.java:
##########
@@ -313,6 +340,38 @@ protected Object toData(FieldMetaData fmd, Object val,
StoreContext ctx) {
}
}
+ /**
+ * Return the database value of the given element of a collection whose
+ * elements are converted, or {@link #NULL} if the converter fails.
+ */
+ private static Object toConvertedData(FieldMetaData fmd, Object val) {
+ try {
+ return copyDataValue(fmd.getExternalElementValue(val));
+ } catch (RuntimeException re) {
+ // leave the field out of the cache; it is loaded from the
+ // database instead
+ return NULL;
+ }
+ }
+
+ /**
+ * Return a copy of the given database value if it is a mutable array or
+ * date, or the value itself otherwise.
+ */
+ private static Object copyDataValue(Object val) {
+ if (val instanceof Date) {
Review Comment:
Done.
--
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]