When i try to convert following HQL query :
select distinct rgp.dgRegexGroups.regexGroup, 0 FROM DgRegexPatterns rgp where rgp.dgRegexGroups.id not in ( 1,05,6,07)
using Hibernate dynamic query translator, it gives me correct SQL like:
select
distinct dgregexgro1_.regex_group as col_0_0_,
0 as col_1_0_
from
dg_regex_patterns dgregexpat0_,
dg_regex_groups dgregexgro1_
where
dgregexpat0_.regex_group_id=dgregexgro1_.id
and (
dgregexpat0_.regex_group_id not in ( 1,5,6,7 )
)
But if I add 08 or 09 in the IN clause it gives me QuerySyntaxException.
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 9 near line 1, column 136 [select distinct rgp.dgRegexGroups.regexGroup, 0 FROM
com.dataguise.hibernate.DgRegexPatterns rgp where rgp.dgRegexGroups.id not in ( 09)]
Did anyone know why this is happening? Is it a hibernate version specific issue? As i am currently using Hibernate-3.3 version. Did someone test this issue in the latest hibernate version?
Will you try to replace hard coded parameters in "in" section with query parameter, like ":p". And then path your parameters as List and call query execution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.