openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r653176 - in /openjpa: branches/1.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/ branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/ trunk/openjpa-kernel/src/main/jjtree...
Date Sun, 04 May 2008 03:26:25 GMT
Author: fancy
Date: Sat May  3 20:26:24 2008
New Revision: 653176

URL: http://svn.apache.org/viewvc?rev=653176&view=rev
Log:
OPENJPA-573 JPQL: The combination LIKE ESCAPE does not accept parameters

Modified:
    openjpa/branches/1.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
    openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java
    openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java

Modified: openjpa/branches/1.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt?rev=653176&r1=653175&r2=653176&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
(original)
+++ openjpa/branches/1.1.x/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
Sat May  3 20:26:24 2008
@@ -1250,7 +1250,7 @@
 
 void pattern_value() #PATTERNVALUE : { }
 {
-	input_parameter() | string_literal()
+	(input_parameter() | string_literal())
 	[(<ESCAPE> escape_character() #ESCAPECHARACTER)]
 }
 

Modified: openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java?rev=653176&r1=653175&r2=653176&view=diff
==============================================================================
--- openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java
(original)
+++ openjpa/branches/1.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java
Sat May  3 20:26:24 2008
@@ -23,7 +23,6 @@
 
 import org.apache.openjpa.persistence.common.apps.*;
 import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
-import org.apache.openjpa.persistence.InvalidStateException;
 
 public class TestEJBQLCondExpression extends AbstractTestCase {
 
@@ -163,6 +162,13 @@
         assertNotNull(result);
         assertEquals(0, result.size());
 
+        query = "SELECT o.name FROM CompUser o WHERE o.name LIKE ?1 ESCAPE '|'";
+
+        result = em.createQuery(query).setParameter(1, "%|_%").getResultList();
+
+        assertNotNull(result);
+        assertEquals(0, result.size());
+
         endEm(em);
     }
 
@@ -268,7 +274,7 @@
 
         String query =
             "SELECT o.name FROM CompUser o WHERE o.address.zipcode = ANY (" +
-                " SELECT s FROM CompUser s WHERE s.address.country IS NOT NULL )";
+                " SELECT s.computerName FROM CompUser s WHERE s.address.country IS NOT NULL
)";
 
         List result = em.createQuery(query).getResultList();
 

Modified: openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt?rev=653176&r1=653175&r2=653176&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt (original)
+++ openjpa/trunk/openjpa-kernel/src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt Sat
May  3 20:26:24 2008
@@ -1250,7 +1250,7 @@
 
 void pattern_value() #PATTERNVALUE : { }
 {
-	input_parameter() | string_literal()
+	(input_parameter() | string_literal())
 	[(<ESCAPE> escape_character() #ESCAPECHARACTER)]
 }
 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java?rev=653176&r1=653175&r2=653176&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/expressions/TestEJBQLCondExpression.java
Sat May  3 20:26:24 2008
@@ -23,7 +23,6 @@
 
 import org.apache.openjpa.persistence.common.apps.*;
 import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
-import org.apache.openjpa.persistence.InvalidStateException;
 
 public class TestEJBQLCondExpression extends AbstractTestCase {
 
@@ -163,6 +162,13 @@
         assertNotNull(result);
         assertEquals(0, result.size());
 
+        query = "SELECT o.name FROM CompUser o WHERE o.name LIKE ?1 ESCAPE '|'";
+
+        result = em.createQuery(query).setParameter(1, "%|_%").getResultList();
+
+        assertNotNull(result);
+        assertEquals(0, result.size());
+
         endEm(em);
     }
 
@@ -268,7 +274,7 @@
 
         String query =
             "SELECT o.name FROM CompUser o WHERE o.address.zipcode = ANY (" +
-                " SELECT s FROM CompUser s WHERE s.address.country IS NOT NULL )";
+                " SELECT s.computerName FROM CompUser s WHERE s.address.country IS NOT NULL
)";
 
         List result = em.createQuery(query).getResultList();
 



Mime
View raw message