You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2007/08/01 23:15:40 UTC
svn commit: r561953 - in /cayenne/main/trunk:
docs/doc/src/main/resources/RELEASE-NOTES.txt
framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLUpdateTest.java
Author: aadamchik
Date: Wed Aug 1 14:15:37 2007
New Revision: 561953
URL: http://svn.apache.org/viewvc?view=rev&rev=561953
Log:
CAY-837 EJBQL Update Statement Support
Modified:
cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLUpdateTest.java
Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?view=diff&rev=561953&r1=561952&r2=561953
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Wed Aug 1 14:15:37 2007
@@ -20,6 +20,7 @@
CAY-833 Remove API for flipping callbacks state in the ClientServerChannel - this is a non-feature
CAY-834 DataContext and DataDomain must support lifecycle callbacks out of the box without wrapping
CAY-836 EJBQL Delete Statement Support
+CAY-837 EJBQL Update Statement Support
Bug Fixes Since M1:
Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLUpdateTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLUpdateTest.java?view=diff&rev=561953&r1=561952&r2=561953
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLUpdateTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLUpdateTest.java Wed Aug 1 14:15:37 2007
@@ -85,14 +85,14 @@
notUpdated = DataObjectUtils.objectForQuery(context, check);
assertEquals(new Long(0l), notUpdated);
}
-
+
public void testUpdateNoQualifierNull() throws Exception {
createTestData("prepare");
ObjectContext context = createDataContext();
EJBQLQuery check = new EJBQLQuery("select count(p) from Painting p "
- + "WHERE p.paintingTitle is NULL or p.estimatedPrice is not null");
+ + "WHERE p.estimatedPrice is not null");
Object notUpdated = DataObjectUtils.objectForQuery(context, check);
assertEquals(new Long(2l), notUpdated);
@@ -111,6 +111,31 @@
assertEquals(new Long(0l), notUpdated);
}
+ public void testUpdateNoQualifierArithmeticExpression() throws Exception {
+ createTestData("prepare");
+
+ ObjectContext context = createDataContext();
+
+ EJBQLQuery check = new EJBQLQuery("select count(p) from Painting p "
+ + "WHERE p.paintingTitle is NULL or p.estimatedPrice <= 5000");
+
+ Object notUpdated = DataObjectUtils.objectForQuery(context, check);
+ assertEquals(new Long(2l), notUpdated);
+
+ String ejbql = "UPDATE Painting AS p SET p.estimatedPrice = p.estimatedPrice * 2";
+ EJBQLQuery query = new EJBQLQuery(ejbql);
+
+ QueryResponse result = context.performGenericQuery(query);
+
+ int[] count = result.firstUpdateCount();
+ assertNotNull(count);
+ assertEquals(1, count.length);
+ assertEquals(2, count[0]);
+
+ notUpdated = DataObjectUtils.objectForQuery(context, check);
+ assertEquals(new Long(0l), notUpdated);
+ }
+
public void testUpdateNoQualifierMultipleItems() throws Exception {
createTestData("prepare");
@@ -260,6 +285,5 @@
notUpdated = DataObjectUtils.objectForQuery(context, check);
assertEquals(new Long(0l), notUpdated);
}
-
-
+
}