首页 > 技术文章 > 数据库异常:SQL Error: 0, SQLState: S0022

7q4w1e 2018-12-10 13:56 原文

问题描述

在本地搭建 mysql + MyEclipse + tomcat,系统跑起来之后,调用自己写的查询接口,报错“SQL Error: 0, SQLState: S0022”

具体报错:

 - could not read column value from result set: S_CAPTION; Column 'S_CAPTION' not found.
 - SQL Error: 0, SQLState: S0022
 - Column 'S_CAPTION' not found.

org.hibernate.exception.SQLGrammarException: could not execute query 

 

问题原因

在 SQL 语句中,使用了别名

 

解决方案

在数据库连接的地方加参数值“?useOldAliasMetadataBehavior=true”,例如:

我的连接方式在文件“applicationContext.xml”中

 

参考网址:https://blog.csdn.net/tang745163962/article/details/41726443

推荐阅读