本质原因:配置的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. GTA4 EFLC cheat code

    GTA4 EFLC cheat code 提示警告:您的图像设置接近或超出您的系统推荐资源限制,为了使游戏运行更加流畅推荐你降低你的图像设置. 在游戏目录新建名为 commandline的txt文本文 ...

  2. 异常-Throwable的几个常见方法

    package cn.itcast_04; import java.text.ParseException; import java.text.SimpleDateFormat; import jav ...

  3. char 、 unsigned char 互相转化

    1. 利用unsigned char (即uchar) 保存char 数据  ,直接赋值即可 unsigned char uc; char c=-33; uc= c; cout<<(int ...

  4. js跳转页面与打开新窗口的方法

    1.超链接<a href="http://www.jb51.net" title="脚本之家">Welcome</a> 等效于js代码 ...

  5. mysql计算QPS

    首先连接上mysql: $ mysql -h .x -P3306 -uusername -p123456 进入Mysql之后,查询general_log: mysql> SHOW VARIABL ...

  6. DataSnap跨域

  7. 《python解释器源码剖析》第11章--python虚拟机中的控制流

    11.0 序 在上一章中,我们剖析了python虚拟机中的一般表达式的实现.在剖析一遍表达式是我们的流程都是从上往下顺序执行的,在执行的过程中没有任何变化.但是显然这是不够的,因为怎么能没有流程控制呢 ...

  8. JDBC的两种sql命令发送器比较【Statement:PreparedStatement】

    PreparedStatement 接口继承 Statement接口如果需要多次执行一个SQL语句,可以使用PreparedStatement对象.在创建PreparedStatement对象时,通过 ...

  9. (三) 结构化查询语言SQL——1

    1. SQL概述 SQL,结构化查询语言,重要性不必在赘述了,基本上开发软件没有不用到的,此外在一些大数据也有广泛的应用.SQL主要包含数据定义语言(DDL).数据操纵语言(DML)以及数据控制语言( ...

  10. Linux磁盘分区的实用管理命令

    系统环境:Centos6.7 命令信息: 1.lsblk  列出分区信息,可以查看分区的光在目录和使用情况  (读取内存中的分区表信息) 2.fdisk 用来创建MBR分区(也可以创建GPT分区,但是 ...