openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r499196 - /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
Date Wed, 24 Jan 2007 00:39:18 GMT
Author: mprudhom
Date: Tue Jan 23 16:39:18 2007
New Revision: 499196

URL: http://svn.apache.org/viewvc?view=rev&rev=499196
Log:
When performing a bulk update in-memory, also support Literal and Constant parameters, since
they might be used in their JDBC implementation when the original query was executed against
the database.

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

Modified: incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java?view=diff&rev=499196&r1=499195&r2=499196
==============================================================================
--- incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
(original)
+++ incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
Tue Jan 23 16:39:18 2007
@@ -33,6 +33,8 @@
 import org.apache.openjpa.enhance.PersistenceCapable;
 import org.apache.openjpa.kernel.exps.AggregateListener;
 import org.apache.openjpa.kernel.exps.FilterListener;
+import org.apache.openjpa.kernel.exps.Constant;
+import org.apache.openjpa.kernel.exps.Literal;
 import org.apache.openjpa.kernel.exps.Val;
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.rop.EagerResultList;
@@ -1058,8 +1060,18 @@
             Map.Entry e = (Map.Entry) it.next();
             FieldMetaData fmd = (FieldMetaData) e.getKey();
 
-            Val value = (Val) e.getValue();
-            Object val = value.evaluate(ob, null, getStoreContext(), params);
+            Object val;
+            Object value = e.getValue();
+            if (value instanceof Val) {
+                val = ((Val) value).
+                    evaluate(ob, null, getStoreContext(), params);
+            } else if (value instanceof Literal) {
+                val = ((Literal) value).getValue();
+            } else if (value instanceof Constant) {
+                val = ((Constant) value).getValue(params);
+            } else {
+                val = null;
+            }
 
             OpenJPAStateManager sm = _broker.getStateManager(ob);
             int i = fmd.getIndex();



Mime
View raw message