I've encountered a couple problems trying to use the LIKE operator.
1) It doesn't work when the pattern is a query parameter. The error happened with it tried to cast a Neo4jQueryParameter to a String on the last line of Neo4jQueryRendererDelegate.predicateLike(). I no longer have the exception trace for that though.
2) The ESCAPE clause doesn't seem to work - after the core Hibernate code parses the query successfully, I get the following exception:
Caused by: org.hibernate.hql.ParsingException: HQL000002: The query SELECT e FROM com.nokia.nspos.model.domain.mock.entities.MockEntity e WHERE (mockString LIKE 'i' ESCAPE '\') is not valid; Parser error messages: [[statement, statementElement, selectStatement, queryExpression, querySpec, whereClause, logicalExpression, expression, logicalOrExpression, logicalAndExpression, negatedExpression, equalityExpression, relationalExpression, concatenation, additiveExpression, multiplyExpression, unaryExpression, atom, expressionOrVector, expression, logicalOrExpression, logicalAndExpression, negatedExpression, equalityExpression, relationalExpression, likeEscape, concatenation, additiveExpression, multiplyExpression, unaryExpression]: line 1:108 state 0 (decision=68) no viable alt; token=[@35,108:108='<EOF>',<-1>,1:108], [statement, statementElement, selectStatement, queryExpression, querySpec, whereClause, logicalExpression, expression, logicalOrExpression, logicalAndExpression, negatedExpression, equalityExpression, relationalExpression, concatenation, additiveExpression, multiplyExpression, unaryExpression, atom]: line 1:108 mismatched token: [@35,108:108='<EOF>',<-1>,1:108]; expecting type RIGHT_PAREN]. at org.hibernate.hql.QueryParser.parseQuery(QueryParser.java:70) at org.hibernate.ogm.datastore.neo4j.query.parsing.impl.Neo4jBasedQueryParserService.parseQuery(Neo4jBasedQueryParserService.java:40) at org.hibernate.ogm.query.impl.OgmQueryTranslator.getLoader(OgmQueryTranslator.java:135) at org.hibernate.ogm.query.impl.OgmQueryTranslator.doCompile(OgmQueryTranslator.java:122) at org.hibernate.ogm.query.impl.LegacyParserBridgeQueryTranslator.compile(LegacyParserBridgeQueryTranslator.java:55) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:115) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:76) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:150) at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:302) at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:240) at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1907) at org.hibernate.engine.spi.SessionDelegatorBaseImpl.createQuery(SessionDelegatorBaseImpl.java:369) at org.hibernate.ogm.jpa.impl.OgmEntityManager.createQuery(OgmEntityManager.java:246)
|