cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From and...@apache.org
Subject svn commit: r834795 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/
Date Wed, 11 Nov 2009 08:03:13 GMT
Author: andrey
Date: Wed Nov 11 08:03:12 2009
New Revision: 834795

URL: http://svn.apache.org/viewvc?rev=834795&view=rev
Log:
CAY-1305 EJBQL doesn't support null 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/access/jdbc/EJBQLConditionTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.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=834795&r1=834794&r2=834795&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 Wed Nov 11 08:03:12 2009
@@ -8,6 +8,15 @@
 http://issues.apache.org/cayenne/
 
 ----------------------------------
+Release: 3.0 RC 1
+Date: 
+----------------------------------
+
+Bug Fixes Since beta1:
+
+CAY-1305 EJBQL doesn't support null parameters
+
+----------------------------------
 Release: 3.0 beta 1
 Date: 3 November 2009
 ----------------------------------

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java?rev=834795&r1=834794&r2=834795&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLConditionTranslator.java
Wed Nov 11 08:03:12 2009
@@ -48,6 +48,7 @@
 import org.apache.cayenne.map.DbRelationship;
 import org.apache.cayenne.reflect.AttributeProperty;
 import org.apache.cayenne.reflect.ClassDescriptor;
+import org.apache.cayenne.reflect.Property;
 
 /**
  * @since 3.0
@@ -705,13 +706,14 @@
                     throw new EJBQLException("Unmapped id variable: " + id);
                 }
                 String pathChunk = translator.lastPathComponent;
-                AttributeProperty property = (AttributeProperty) descriptor
-                        .getProperty(pathChunk);
-                String atrType = property.getAttribute().getType();
-
-                type = TypesMapping.getSqlNameByType(TypesMapping
-                        .getSqlTypeByJava(atrType));
+                
+                Property property = descriptor.getProperty(pathChunk);
+                if (property instanceof AttributeProperty) {
+                    String atrType = ((AttributeProperty) property).getAttribute().getType();
 
+                    type = TypesMapping.getSqlNameByType(TypesMapping
+                            .getSqlTypeByJava(atrType));
+                }
             }
             context.popMarker();
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java?rev=834795&r1=834794&r2=834795&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/EJBQLQueryTest.java
Wed Nov 11 08:03:12 2009
@@ -263,4 +263,10 @@
 
         assertEquals(w.getBuffer().toString(), s.toString());
     }
+    
+    public void testNullParameter() {
+        EJBQLQuery query = new EJBQLQuery("select p from Painting p WHERE p.toArtist=:x");
+        query.setParameter("x", null);
+        createDataContext().performQuery(query);
+    }
 }



Mime
View raw message