本质原因:配置的Java Bean,由Hibernate自动产生的SQL语句中有语法错误

原因如下:

  情况1.存在字段名/表名与数据库关键字冲突

  情况2.MySQL5.0以后与MySQL5.0以前事务引擎InnoDB配置微妙不同

解决方案:

//MySQL 5.0之后【engine = InnoDB】
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property> //NySQL 5.0之前【type = InnoDB】
<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>

Java EE 之 Hibernate异常解决:org.hibernate.exception.SQLGrammarException: could not execute statement的更多相关文章

  1. 报错:org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement

    org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n ...

  2. Java EE 之 Hibernate异常总结【4】org.hibernate.exception.SQLGrammarException: could not execute statement

    本质原因:配置的Java Bean,由Hibernate自动产生的SQL语句中有语法错误 原因如下: 情况1.存在字段名/表名与数据库关键字冲突 情况2.MySQL5.0以后与MySQL5.0以前事务 ...

  3. [jnhs]hibernate只能创建一张/表不创建表com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'kaihu.t_client_info' doesn't exist和org.hibernate.exception.SQLGrammarException: could not execute statement

    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'kaihu.t_client_info' doesn't exist ...

  4. HTTP Status 500 - Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement

    1.什么操作出现:当我在项目中添加产品或者修改时,浏览器出现HTTP Status 500 - Request processing failed; nested exception is org.h ...

  5. 【hibernate】报错:org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement

    报错如下: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a ...

  6. SpringBoot保存数据报错:could not execute statement; SQL [n/a]; constraint [PRIMARY];nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

    使用SpringBoot做JAVA开发时,用Repository.save();保存数据的时候遇到了报错: could not execute statement; SQL [n/a]; constr ...

  7. Hibernate错误:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update

    报错:Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execu ...

  8. ERROR: Field 'PostId' doesn't have a default value Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not execute statement

    例子: Post p = new Post(); p.setPostId(3); p.setPostName("技术"); 在执行数据保持时提示session.save(p); 的 ...

  9. org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query

    原因: 这个问题的解决方案很简单,主要是因为数据库中不存在相关的表或者列. org.springframework.dao.InvalidDataAccessApiUsageException: Pa ...

随机推荐

  1. 服务端相关知识学习(三)Zookeeper的配置

    前面两篇文章介绍了Zookeeper是什么和可以干什么,那么接下来我们就实际的接触一下Zookeeper这个东西,看看具体如何使用,有个大体的感受,后面再描述某些地方的时候也能在大脑中有具体的印象.本 ...

  2. http请求204

    项目中发现一个奇怪的问题,请求的时候同一个接口有两个请求,而且有一个状态为204,有一个为200 在网上查看资料后得知,是因为跨域而引起的,OPTIONS是一种“预检请求”,浏览器在处理跨域访问的请求 ...

  3. element-ui Cascader 级联选择器 点击label选中

    通过修改label的样式解决: 注意:el-cascader-panel 是直接挂载在body上的,所以需要全局设置 .el-cascader-panel .el-radio{ width: 100% ...

  4. Linux 下vim命令详解

    原博文:https://www.cnblogs.com/zknublx/p/6058679.html 高级一些的编辑器,都会包含宏功能,vim当然不能缺少了,在vim中使用宏是非常方便的: :qx   ...

  5. Solved: XXX esx.problem.hyperthreading.unmitigated.formatOnHost not found XXX

    esxi 出现XXX esx.problem.hyperthreading.unmitigated.formatOnHost not found XXX 问题. 回避方法: 将高级设置-->Us ...

  6. MySQL数据库笔记五:多表查询

    1.表与表之间的关系 一对一:用户表和身份信息表,用户表是主表 例如:男人表 .女人表 create table man( mid int primary key auto_increment, mn ...

  7. java_day03_流程控制

    ch03 目标:表达式和流程控制 ---------------------------------------------- 1.实例变量和局部变量 程序的基本功能是处理数据,程序中需要使用变量来接 ...

  8. C语言求π的方法

    #include <stdio.h> #include <math.h> int main() { int r; double PI,s; scanf("%d&quo ...

  9. kafka api的基本使用

    kafka API kafka Consumer提供两套Java API:高级Consumer API.和低级Consumer API. 高级Consumer API 优点: 高级API写起来简单,易 ...

  10. springboot2.1.7整合Druid

    一.maven的依赖:文中就贴重点的, 其他依赖就不贴了 <dependency> <groupId>com.alibaba</groupId> <artif ...