java.lang.StringIndexOutOfBoundsException: String index out of range: 0

数组访问越界,0表示第一个字符访问就越界,遇到这个错误是在用hibernate查询SQL的时候出现的。
查询sql举例:

select '' as name from table;

查询结果解析的时候,吊毛的hibernate解析 ” 的时候直接charat(0), 然后数组访问越界,大概这个原因,没深入研究,也可能是jdbc解析的时候出的问题。
修改方法: 将”改为‘ ’,中间加个空格而不要直接空串

select ' ' as name from table;

猜你喜欢

转载自blog.csdn.net/qq_36666651/article/details/79850729