openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r487925 - /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ContainsExpression.java
Date Sun, 17 Dec 2006 01:00:00 GMT
Author: mprudhom
Date: Sat Dec 16 16:59:59 2006
New Revision: 487925

URL: http://svn.apache.org/viewvc?view=rev&rev=487925
Log:
Convert single values into Collections in order to support varargs "IN" expressions.

Modified:
    incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ContainsExpression.java

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ContainsExpression.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ContainsExpression.java?view=diff&rev=487925&r1=487924&r2=487925
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ContainsExpression.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ContainsExpression.java
Sat Dec 16 16:59:59 2006
@@ -16,6 +16,7 @@
 package org.apache.openjpa.kernel.exps;
 
 import java.util.Collection;
+import java.util.Collections;
 
 import org.apache.openjpa.kernel.StoreContext;
 
@@ -68,7 +69,8 @@
      * Return the container collection for the given value.
      */
     protected Collection getCollection(Object obj) {
-        return (Collection) obj;
+        return obj instanceof Collection ?
+            (Collection) obj : Collections.singleton(obj);
     }
 
     public void acceptVisit(ExpressionVisitor visitor) {



Mime
View raw message