openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Georgi Naplatanov (JIRA)" <>
Subject [jira] Created: (OPENJPA-573) JPQL: The combination LIKE ESCAPE does not accept parameters
Date Wed, 16 Apr 2008 22:21:21 GMT
JPQL: The combination LIKE ESCAPE does not accept parameters

                 Key: OPENJPA-573
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.0.2
         Environment: SUN JDK (AMD64) for Linux
            Reporter: Georgi Naplatanov
             Fix For: 1.1.0

If i use constants like this :

SELECT object FROM MyObject object WHERE object.path LIKE '%|_%' ESCAPE '|'

all is ok, but if I want to use parameters - exception is thrown.


public class MySimpleObject {

	String Id ;
	@Column(name="value", nullable=false, length=36)
	String value  ;

EntityManager em = emf.createEntityManager() ;
Query q = em.createQuery("SELECT x FROM MySimpleObject x WHERE x.value LIKE ?1 ESCAPE '|'")
q.setParameter(1, "%|_%") ;
List<MySimpleObject> res = q.getResultList() ;

Exception in thread "main" <openjpa-1.1.0-SNAPSHOT-r422266:648359 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: Encountered "ESCAPE" at character 54, but
expected: ["AND", "GROUP", "HAVING", "OR", "ORDER", <EOF>].
	at org.apache.openjpa.kernel.jpql.JPQL.generateParseException(
	at org.apache.openjpa.kernel.jpql.JPQL.jj_consume_token(
	at org.apache.openjpa.kernel.jpql.JPQL.parseQuery(
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(
	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.<init>(
	at org.apache.openjpa.kernel.jpql.JPQLParser.parse(
	at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(
	at org.apache.openjpa.datacache.QueryCacheStoreQuery.newCompilation(
	at org.apache.openjpa.kernel.QueryImpl.newCompilation(
	at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(
	at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(
	at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(
	at org.apache.openjpa.kernel.QueryImpl.getOperation(
	at org.apache.openjpa.kernel.DelegatingQuery.getOperation(
	at org.apache.openjpa.persistence.QueryImpl.execute(
	at org.apache.openjpa.persistence.QueryImpl.getResultList(
	at Tester.testEscape(
	at Tester.main(

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message