Skip to content

Commit cde4f28

Browse files
committed
Issue 1815: Transforming object types for collections
Signed-off-by: Will Dazey <[email protected]>
1 parent 2be887a commit cde4f28

File tree

1 file changed

+6
-1
lines changed
  • foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions

1 file changed

+6
-1
lines changed

foundation/org.eclipse.persistence.core/src/main/java/org/eclipse/persistence/internal/expressions/QueryKeyExpression.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.ArrayList;
2222
import java.util.Arrays;
2323
import java.util.Collection;
24+
import java.util.Collections;
2425
import java.util.Enumeration;
2526
import java.util.HashMap;
2627
import java.util.Iterator;
@@ -34,6 +35,7 @@
3435
import org.eclipse.persistence.expressions.Expression;
3536
import org.eclipse.persistence.internal.helper.DatabaseField;
3637
import org.eclipse.persistence.internal.helper.DatabaseTable;
38+
import org.eclipse.persistence.internal.helper.Helper;
3739
import org.eclipse.persistence.internal.identitymaps.CacheId;
3840
import org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy;
3941
import org.eclipse.persistence.internal.sessions.AbstractRecord;
@@ -424,8 +426,11 @@ public Object getFieldValue(Object objectValue, AbstractSession session) {
424426
Object fieldValue = objectValue;
425427
if (mapping != null) {
426428
if (mapping.isAbstractDirectMapping() || mapping.isDirectCollectionMapping()) {
429+
427430
// CR#3623207, check for IN Collection here not in mapping.
428-
if (objectValue instanceof Collection) {
431+
// Translate the individual elements of a collection to match the mapping, but only if the mapping is not to a collection itself
432+
Class<?> cls = mapping.getFieldClassification(getField());
433+
if (objectValue instanceof Collection && (cls != null && !(cls.isArray() || cls.isInstance(Collection.class)))) {
429434
// This can actually be a collection for IN within expressions... however it would be better for expressions to handle this.
430435
Collection values = (Collection)objectValue;
431436
Vector fieldValues = new Vector(values.size());

0 commit comments

Comments
 (0)