ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 7
问题:
使用hibernate4.1.1,数据库使用mysql5.1.30,使用hibernate自动生成数据库表时,hibernate方言使用org.hibernate.dialect.MySQLInnoDBDialect,自动生成表时会出现错误。
控制台报错如下:
十一月 28, 2016 4:15:22 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: HHH000388: Unsuccessful: create table NEWS (ID integer not null auto_increment, TITLE varchar(255), AUTHOR varchar(255), DATE datetime, primary key (ID)) type=InnoDB
十一月 28, 2016 4:15:22 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 7
十一月 28, 2016 4:15:22 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000232: Schema update complete
原因分析:
是因为type=InnoDB在5.0以前是可以使用的,但5.1之后就不行了。如果我们把type=InnoDB改为engine=InnoDB就不会有这个问题。
但是,我想使用Hibernate,自动帮我建表,怎么办呢。这就与我们指定的数据库方言(dialect)有关了。
解决办法:
只需要修改配置:
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
修改为:
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
转载自:http://www.th7.cn/db/mysql/201606/192445.shtml
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 7的更多相关文章
- C# Mysql You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ????
有几年没用过MySql数据了,今天在使用C#访问MySql数据库时出现了一个小插曲. 错误提示: You have an error in your SQL syntax; check the man ...
- MySql 执行语句错误 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
关于用Power Designer 生成sql文件出现 错误 [Err] 1064 - You have an error in your SQL syntax; check the manual ...
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
mysql中如果字段使用了关键字,在插入和更新时会提示 You have an error in your SQL syntax; check the manual that corresponds ...
- MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...
下面是我update数据库时打印出来的异常: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSynt ...
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like '%逸%'' at line 1
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-/ ...
- 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups)VALUES('1','hh','hh@163.com','Boss')' at line 1
mysql8.0版本 在已存在的表里插入一条数据 insert INTO api_user(id,username,email,groups)VALUES('1','hh','hh@163.com', ...
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group t1,customer t2
### SQL: select t1.gid,t1.gname,t1.gvalue,t1.gtype, t1.gaddress,t1.gmembers, t1.gcode,t1.gphone, t2. ...
- 解决You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (order_name, customer)
在学习hibernate一对多映射关系时,根据视频学习的时候,例子是顾客和订单的问题,一个顾客有多个订单.按照视频中的敲代码出现了You have an error in your SQL synta ...
- mybatis批量更新update-设置多个字段值 报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
mybatis批量更新update-设置多个字段值 2016年08月01日 12:49:26 姚一号 阅读数:29539 标签: mysql mybatis批量更新批量更新allowMultiQuer ...
随机推荐
- [转]Scrapy入门教程
关键字:scrapy 入门教程 爬虫 Spider 作者:http://www.cnblogs.com/txw1958/ 出处:http://www.cnblogs.com/txw1958/archi ...
- [Java Basics3] XML, Unit testing
What's the difference between DOM and SAX? DOM creates tree-like representation of the XML document ...
- win32自绘按钮,使用GDI+(二)
一.解决上一篇的两个问题. 1.按钮背景透明 方法是,在绘制按钮之前,向按钮的父窗口发生WM_CTLCOLORBTN消息.该消息返回一个画刷句柄,系统使用该画刷句柄画出按钮的背景.所以我们在处理这个消 ...
- POJ 2653
题目大意:一个小孩不断往地上扔棍子,共n根,求结束后共有多少根不与去他相交. 解法思路:典型的判断线段相交问题,利用快速排斥+双跨立判断相交,最后输出没相交的. (图片来源:http://www.2c ...
- c#小小总结(设计模式)
前言 对于设计模式,知道一些(当然有些仅限于知道而已) 内容 1.单例模式 2.建造者模式 把单个模块通过不同的搭配方式创造出不同的产品 3.观察者模式 一对多的行为 当“一”改变的时候 “多”的每 ...
- 学习RaphaelJS矢量图形包--Learning Raphael JS Vector Graphics中文翻译(一)
(原文地址:http://www.cnblogs.com/idealer3d/p/LearningRaphaelJSVectorGraphics.html) 前面3篇博文里面,我们讲解了一本叫做< ...
- ABAP下载txt文件
IF NOT DOWN_F[] IS INITIAL. CASE DOWN_MODE . "下载模式是放在所选路径下的.TXT文档中 WHEN 'X' . CA ...
- CE 消息处理
MFC消息发送: static HANDLE hWnd =FindWindow(NULL,_T("Client")); //找到窗口 if(hWnd == INVALID_HAND ...
- 笔记 线程(threads)
线程:CPU使用的基本单元(线程ID.程序计数器.寄存器集合.栈). 多线程:一个进程有多个线程 多线程的优点: 增加响应度:当一个交互程序部分阻塞,该程序能继续执行 一个应用程序在同一地址空间有多个 ...
- python之环境搭建windows版
1.先到python官网下载属于自己的的python版本,有linux版,有mac版,有windows版:https://www.python.org/downloads/windows/ 2.下载完 ...