openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r487403 - /incubator/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
Date Fri, 15 Dec 2006 00:04:54 GMT
Author: mprudhom
Date: Thu Dec 14 16:04:53 2006
New Revision: 487403

URL: http://svn.apache.org/viewvc?view=rev&rev=487403
Log:
Allow updating in-memory values with complex expressions, rather than just simple Constants
and Literals.

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=487403&r1=487402&r2=487403
==============================================================================
--- 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
Thu Dec 14 16:04:53 2006
@@ -32,8 +32,8 @@
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.enhance.PersistenceCapable;
 import org.apache.openjpa.kernel.exps.AggregateListener;
-import org.apache.openjpa.kernel.exps.Constant;
 import org.apache.openjpa.kernel.exps.FilterListener;
+import org.apache.openjpa.kernel.exps.Val;
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.lib.rop.EagerResultList;
 import org.apache.openjpa.lib.rop.MergedResultObjectProvider;
@@ -1057,10 +1057,9 @@
             it.hasNext();) {
             Map.Entry e = (Map.Entry) it.next();
             FieldMetaData fmd = (FieldMetaData) e.getKey();
-            if (!(e.getValue() instanceof Constant))
-                throw new UserException(_loc.get("only-update-constants"));
-            Constant value = (Constant) e.getValue();
-            Object val = value.getValue(params);
+
+            Val value = (Val) e.getValue();
+            Object val = value.evaluate(ob, null, getStoreContext(), params);
 
             OpenJPAStateManager sm = _broker.getStateManager(ob);
             int i = fmd.getIndex();



Mime
View raw message