openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-612) Add support for calculating update value in QueryImpl.updateInMemory
Date Tue, 27 May 2008 17:10:02 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12600204#action_12600204
] 

Albert Lee commented on OPENJPA-612:
------------------------------------

I am wondering if evaluate() in the abstract base class should throw an exception rather than
returning a null?

Index: openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java
===================================================================
--- openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractStoreQuery.java	(revision
659216)
+    
+    public Object evaluate(Object value, Object ob, Object[] params, 
+        OpenJPAStateManager sm) {
+        return null;
+    }    

Otherwise, val will be null and could it cause undesirable/different behavior for AbstractStoreQuery
subclass that has no implementation and/or NPE further on? 

Index: openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
===================================================================
--- openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java	(revision 659216)
             } else {
-                throw new UserException(_loc.get("only-update-primitives"));
+                try {
+                    val = evaluate(value, ob, params, sm, q);
+                } catch (UnsupportedException e1) {
+                    throw new UserException(_loc.get("fail-to-get-update-value"));
+                }
             }

Albert Lee.

> Add support for calculating update value in QueryImpl.updateInMemory
> --------------------------------------------------------------------
>
>                 Key: OPENJPA-612
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-612
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Fay Wang
>         Attachments: openjpa.patch
>
>
> Since Informix does not support update with in/exists subquery in the where clause, when
doing the bulk update against informix, e.g., 
>      "update DeptBeanAno d set d.budget = (d.budget * ?1 + ?2) where d.reportsTo.no =
?3"
>  
> we encounter the error of "only-update-primitives" during updateInMemory. 
>      The attached patch fixes this problem by beefing up the support for arithmetic calcuation
of the update value for updateInMemory.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message