ssh 出错信息:SQLGrammarException: could not execute statement & error performing isolated work

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_38374974/article/details/81433390

参照博客搭建了一个ssh(spring + springMVC + hibernate)框架,想自己玩玩,但是也还是碰到了几个坑,做个笔记。

第一个错误:SQLGrammarException: could not execute statement 

    其实这个错在我这里是因为,主键没有设置自增的原因,所以在创建数据库的时候不能执行,就报错了。

    解决办法:在你的主键上加上: @GeneratedValue(strategy = GenerationType.IDENTITY)

    

    参考博客:https://blog.csdn.net/danchaofan0534/article/details/53608832

第二个错误:SQLGrammarException:error performing isolated work

    这个错误有几种情况:

    1、创建的表中,表名、字段名和数据库的关键字冲突;

    2、mysql5.0以后和mysql5.0以前事务引擎配置的微妙不同:

        开始的配置:hibernate.dialect = org.hibernate.dialect.MySQLDialect

        

        之后的配置:hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

        

        更改之后,再次重启Tomcat,成功:

         

        查看数据库,数据也存入成功。

    参考博客:https://www.cnblogs.com/johnnyzen/p/7804712.html

PS:ssh框架搭建参考博客:https://www.cnblogs.com/xrog/p/6359706.html

猜你喜欢

转载自blog.csdn.net/weixin_38374974/article/details/81433390