【发布时间】:2018-02-23 07:38:26
【问题描述】:
我在 JPA 查询的 where 子句中使用印地语字符。当我在 connsole 中使用 show jpa 打印查询时,字符被替换为 ????。
我用过
value="${jdbc.url};databaseName=${jdbc.databaseName};useUnicode=true;characterEncoding=UTF-8"
在 jdbc url 中,但它没有解决问题。
按照控制台输出。
休眠:选择 facilitysc0_.blockId 作为 col_0_0_,formxpaths1_.xPath 作为 col_1_0_,formxpaths1_.label 作为 col_2_0_,formxpaths1_.formXpathScoreId 作为 col_3_0_,当 ?='all' 时的情况,然后当 formxpaths1_.xPath 不在 (? , ? , ? , ?) then CONVERT(float, count(case when facilitysc0_.score='???' then 1 end))/CONVERT(float, count(case when facilitysc0_.score='???' or facilitysc0_.score= '????' or facilitysc0_.score='???? ????' or facilitysc0_.score='' then 1 end))*100 else CONVERT(FLOAT, count(case when facilitysc0_.score='? ??' then 1 end))/CONVERT(FLOAT, count(case when facilitysc0_.score='???' or facilitysc0_.score='????' then 1 end))*100 end else CONVERT(FLOAT,计数(当 facilitysc0_.score='???' 然后 1 结束时的情况)/CONVERT(FLOAT,计数(当 facilitysc0_.score='???' 或 facilitysc0_.score='????' 然后 1 结束时的情况) ))*100 以 col_4_0_ 结尾,当 ?='all' 时计数(case when facilitysc0_.score='???' or facilitysc0_.score='????' or facilitysc0_.score='???? ????' 或 facilitysc0_.score='' th en 1 end) else count(case when facilitysc0_.score='???' or facilitysc0_.score='????' then 1 end) end as col_5_0_, count(case when facilitysc0_.score='???'然后 1 end) as col_6_0_ from FacilityScore facilitysc0_ inner join FormXpathScoreMapping formxpaths1_ on facilitysc0_.formXpathScoreId=formxpaths1_.formXpathScoreId inner join LastVisitData lastvisitd2_ on facilitysc0_.lastVisitDataId=lastvisitd2_.LastVisitDataId where formxpaths1_.formId=?和 (formxpaths1_.type like 'select_one yes_no%') 和 ((facilitysc0_.score in (? , ?)) 和 (formxpaths1_.xPath in (? , ? , ? , ?)) 或 (facilitysc0_.score in (? , ? , ? , ?)) 和 (formxpaths1_.xPath 不在 (? , ? , ? , ?)) 和 ?='all' 或 facilitysc0_.score 在 (? , ?)) 和 (lastvisitd2_.DateOfVisit 在 ? 和 ? 之间) 和 lastvisitd2_.IsLive=1 按 facilitysc0_.blockId 、 formxpaths1_.xPath 、 formxpaths1_.label 、 formxpaths1_.formXpathScoreId 分组
请帮忙。
【问题讨论】:
-
很难猜测是单纯的显示问题还是转换问题:你的系统是什么,控制台是如何配置的,等等......没有更多的上下文,你的问题是不清楚.
-
@SergeBallesta 嗨,我在 Windows 7 上使用 Eclipse Neon。控制台配置是默认配置。
-
控制台中奇怪的字符并不是什么大问题 - 您是否尝试在实际页面上输出它们?
-
@EvanKnowles 是的,你是对的..我更改了控制台设置并且可以看到字符,但它们仍然没有正确插入到查询中..我查找并发现我们必须在之前放置 N unicode chars..但是 Jpa 抛出未定义 N 的错误发现..我该如何解决这个问题?
-
查询参数将始终显示为 ?在控制台中。查询的实际错误或问题是什么?
标签: java hibernate spring-mvc spring-data-jpa