OPENJPA-573 JPQL: The combination LIKE ESCAPE does not accept parameters

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@653176 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2008-05-04 03:26:24 +00:00
parent 0f32d37668
commit 14eeab2c00
2 changed files with 9 additions and 3 deletions

View File

@ -1250,7 +1250,7 @@ void positional_input_parameter() #POSITIONALINPUTPARAMETER :
void pattern_value() #PATTERNVALUE : { }
{
input_parameter() | string_literal()
(input_parameter() | string_literal())
[(<ESCAPE> escape_character() #ESCAPECHARACTER)]
}

View File

@ -23,7 +23,6 @@ import javax.persistence.EntityManager;
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 @@ public class TestEJBQLCondExpression extends AbstractTestCase {
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 @@ public class TestEJBQLCondExpression extends AbstractTestCase {
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();