[英]Hibernate HQL Issue with IN Clause
When i try to convert following HQL query : 当我尝试转换以下HQL查询时:
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: 使用Hibernate动态查询翻译器,它可以为我提供正确的SQL,例如:
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. 但是,如果我在IN子句中添加08或09,则会给我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.
由于我目前正在使用Hibernate-3.3版本。 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". 您是否会尝试使用查询参数(如“:p”)替换“输入”部分中的硬编码参数。 And then path your parameters as List and call query execution.
然后将您的参数作为List路径并调用查询执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.