Skip to content

Commit

Permalink
Issue 1815: Transforming object types for collections
Browse files Browse the repository at this point in the history
Signed-off-by: Will Dazey <[email protected]>
  • Loading branch information
dazey3 committed Mar 23, 2023
1 parent 2be887a commit cde4f28
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
Expand All @@ -34,6 +35,7 @@
import org.eclipse.persistence.expressions.Expression;
import org.eclipse.persistence.internal.helper.DatabaseField;
import org.eclipse.persistence.internal.helper.DatabaseTable;
import org.eclipse.persistence.internal.helper.Helper;
import org.eclipse.persistence.internal.identitymaps.CacheId;
import org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy;
import org.eclipse.persistence.internal.sessions.AbstractRecord;
Expand Down Expand Up @@ -424,8 +426,11 @@ public Object getFieldValue(Object objectValue, AbstractSession session) {
Object fieldValue = objectValue;
if (mapping != null) {
if (mapping.isAbstractDirectMapping() || mapping.isDirectCollectionMapping()) {

// CR#3623207, check for IN Collection here not in mapping.
if (objectValue instanceof Collection) {
// Translate the individual elements of a collection to match the mapping, but only if the mapping is not to a collection itself
Class<?> cls = mapping.getFieldClassification(getField());
if (objectValue instanceof Collection && (cls != null && !(cls.isArray() || cls.isInstance(Collection.class)))) {
// This can actually be a collection for IN within expressions... however it would be better for expressions to handle this.
Collection values = (Collection)objectValue;
Vector fieldValues = new Vector(values.size());
Expand Down

0 comments on commit cde4f28

Please sign in to comment.