cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r688736 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/
Date Mon, 25 Aug 2008 14:33:10 GMT
Author: aadamchik
Date: Mon Aug 25 07:33:09 2008
New Revision: 688736

URL: http://svn.apache.org/viewvc?rev=688736&view=rev
Log:
CAY-1098 EJBQLQuery can't process java.util.Date parameters

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.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?rev=688736&r1=688735&r2=688736&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Mon Aug 25 07:33:09 2008
@@ -44,6 +44,7 @@
 CAY-1082 ROP: RefreshQuery fails to refresh to-many relationships
 CAY-1083 General Preferences Panel - items misaligned
 CAY-1095 Cayenne attempts to append precision information to DOUBLE types when creating tables
in hsqldb which results in a sql exception.
+CAY-1098 EJBQLQuery can't process java.util.Date parameters
 
 ----------------------------------
 Release: 3.0M4

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java?rev=688736&r1=688735&r2=688736&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
Mon Aug 25 07:33:09 2008
@@ -193,6 +193,7 @@
         javaSqlEnum.put(JAVA_BOOLEAN, Integer.valueOf(Types.BIT));
         javaSqlEnum.put(JAVA_STRING, Integer.valueOf(Types.VARCHAR));
         javaSqlEnum.put(JAVA_SQLDATE, Integer.valueOf(Types.DATE));
+        javaSqlEnum.put(JAVA_UTILDATE, Integer.valueOf(Types.DATE));
         javaSqlEnum.put(JAVA_TIMESTAMP, Integer.valueOf(Types.TIMESTAMP));
         javaSqlEnum.put(JAVA_BIGDECIMAL, Integer.valueOf(Types.DECIMAL));
         javaSqlEnum.put(JAVA_DOUBLE, Integer.valueOf(Types.DOUBLE));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java?rev=688736&r1=688735&r2=688736&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextEJBQLConditionsTest.java
Mon Aug 25 07:33:09 2008
@@ -19,16 +19,19 @@
 package org.apache.cayenne.access;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.art.Artist;
 import org.apache.art.Painting;
 import org.apache.cayenne.DataObjectUtils;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.Persistent;
 import org.apache.cayenne.query.EJBQLQuery;
+import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.unit.CayenneCase;
 
 public class DataContextEJBQLConditionsTest extends CayenneCase {
@@ -38,6 +41,28 @@
         deleteTestData();
     }
 
+    public void testDateParameter() throws Exception {
+        createTestData("prepareCollection");
+
+        ObjectContext context = createDataContext();
+
+        SelectQuery q = new SelectQuery(Artist.class);
+        List<Artist> allArtists = context.performQuery(q);
+
+        Date dob = new Date();
+        allArtists.get(0).setDateOfBirth(dob);
+        context.commitChanges();
+
+        String ejbql = "SELECT a FROM Artist a WHERE a.dateOfBirth = :x";
+
+        EJBQLQuery query = new EJBQLQuery(ejbql);
+        query.setParameter("x", dob);
+        List<?> objects = context.performQuery(query);
+        assertEquals(1, objects.size());
+
+        assertSame(allArtists.get(0), objects.get(0));
+    }
+
     public void testArithmetics() throws Exception {
         createTestData("prepareLike");
 



Mime
View raw message