[英]How should I use COLLATE in Hibernate Query
I'am trying to use COLLATE statement in a Hibernate SQL query but, it doesn't recognize the statement. 我正在尝试在Hibernate SQL查询中使用COLLATE语句,但是无法识别该语句。
CONSULTA: FROM Articulos WHERE activo=0
and (codigodearticulo like '%CIN EMB%' COLLATE='Modern_Spanish_CI_AI'
or descripcion like '%CIN EMB%' COLLATE='Modern_Spanish_CI_AI'
or descripcionadicional like '%CIN EMB%' COLLATE='Modern_Spanish_CI_AI' )
and codigodelinea in
(select CODIGODELINEA from Lineas where CATAUTOPARTES='1')
And when app compile, Hibernate return this exception : 当应用程序编译时,Hibernate返回此异常:
- line 1:107: unexpected token: COLLATE
- line 1:107: unexpected token: COLLATE
- line 1:107: unexpected token: COLLATE
- Error hibernate: unexpected token: COLLATE near line 1, column 107
I can't find the problem, in MSSQL Server it works fine. 我找不到问题,在MSSQL Server中工作正常。
Unfortunately HQL isn't a complete replacement for SQL, and doesn't seem to allow specifying Collation at all. 不幸的是,HQL不能完全替代SQL,而且似乎根本不允许指定归类。
It can be specified on a Criteria query. 可以在条件查询中指定。 See this answer
看到这个答案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.