openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick (JIRA)" <j...@apache.org>
Subject [jira] Closed: (OPENJPA-573) JPQL: The combination LIKE ESCAPE does not accept parameters
Date Wed, 01 Apr 2009 15:19:12 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-573?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Michael Dick closed OPENJPA-573.
--------------------------------

    Resolution: Fixed

> JPQL: The combination LIKE ESCAPE does not accept parameters
> ------------------------------------------------------------
>
>                 Key: OPENJPA-573
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-573
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.2, 1.1.0
>         Environment: SUN JDK 1.6.0.6 (AMD64) for Linux
>            Reporter: Georgi Naplatanov
>            Assignee: Michael Dick
>             Fix For: 1.0.4, 1.2.0, 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.
> Example:
> @Entity
> @Table(name="simple_object")
> public class MySimpleObject {
> 	@Id
> 	String Id ;
> 	
> 	@Basic
> 	@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(JPQL.java:9499)
> 	at org.apache.openjpa.kernel.jpql.JPQL.jj_consume_token(JPQL.java:9376)
> 	at org.apache.openjpa.kernel.jpql.JPQL.parseQuery(JPQL.java:75)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.parse(JPQLExpressionBuilder.java:1733)
> 	at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder$ParsedJPQL.<init>(JPQLExpressionBuilder.java:1720)
> 	at org.apache.openjpa.kernel.jpql.JPQLParser.parse(JPQLParser.java:48)
> 	at org.apache.openjpa.kernel.ExpressionStoreQuery.newCompilation(ExpressionStoreQuery.java:149)
> 	at org.apache.openjpa.datacache.QueryCacheStoreQuery.newCompilation(QueryCacheStoreQuery.java:239)
> 	at org.apache.openjpa.kernel.QueryImpl.newCompilation(QueryImpl.java:656)
> 	at org.apache.openjpa.kernel.QueryImpl.compilationFromCache(QueryImpl.java:638)
> 	at org.apache.openjpa.kernel.QueryImpl.compileForCompilation(QueryImpl.java:604)
> 	at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:666)
> 	at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1486)
> 	at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
> 	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:227)
> 	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:277)
> 	at Tester.testEscape(Tester.java:75)
> 	at Tester.main(Tester.java:93)

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


Mime
View raw message