原 hibernate 出现Caused by: java.sql.SQLException: Column 'id' not found.异常

用hibernate进行映射查询时,出现Caused by: java.sql.SQLException: Column ‘id’ not found 异常,检查数据库表及映射都有id且已经正确映射,google后发现原因为: Your query doesn’t return a field named id...

用hibernate进行映射查询时,出现Caused by: java.sql.SQLException: Column ‘id’ not found 异常,检查数据库表及映射都有id且已经正确映射,google后发现原因为:
Your query doesn’t return a field named id即查询sql中没有查询出主键id列,但返回结果集中用到,故出现异常特此记录。

详细解答见下:
http://stackoverflow.com/questions/34164411/caused-by-java-sql-sqlexception-column-id-not-found

原文地址:https://blog.csdn.net/motrsky/article/details/52369614

本文标题为:原 hibernate 出现Caused by: java.sql.SQLException: Column 'id' not found.异常

基础教程推荐