hibernate--MYSQL建表时type=InnoDB和Engine=InnoDB注意点
来源:互联网 发布:淘宝艺术照服装 编辑:程序博客网 时间:2024/05/16 14:15
hibernate初学在配置好一切之后,运行然后报错,接下来问度娘,最后解决。。。
首先看报错
[org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@6cea706c] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.Hibernate: create table NEWS ( ID integer not null auto_increment, TITLE varchar(255), AUTHOR varchar(255), DATE date, primary key (ID) ) type=InnoDBCaused by: com.mysql.jdbc.exceptions.jdbc4.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 'type=InnoDB' at line 7WARN: GenerationTarget encountered exception accepting command : Error executing DDL via JDBC StatementHibernate: insert into NEWS (TITLE, AUTHOR, DATE) values (?, ?, ?)WARN: SQL Error: 1146, SQLState: 42S02ERROR: Table 'hibtest.news' doesn't exist
里面有建表语句:
Hibernate: create table NEWS ( ID integer not null auto_increment, TITLE varchar(255), AUTHOR varchar(255), DATE date, primary key (ID) ) type=InnoDB
报错也说了
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
我们这里出来问题,这是mysql5.1以前的写法,5.1之后变化如下:
engine = InnoDB
现在找出问题所在,我们只要修改hibernate.cfg.xml中的方言配置就可以了,不需要修改其他的
正确的做法如下:
org.hibernate.dialect.MySQL5InnoDBDialect
阅读全文
0 0
- hibernate--MYSQL建表时type=InnoDB和Engine=InnoDB注意点
- hibernate4--MYSQL建表时type=InnoDB和Engine=InnoDB注意点
- mysql ENGINE=InnoDB
- mysql ENGINE=InnoDB
- mysql ENGINE=InnoDB
- mysql ENGINE=InnoDB
- mysql中engine=innodb和engine=myisam区别
- MySQL 'type=InnoDB' 错误
- mysql建表时engine=innodb和engine=myisam的区别
- Hibernate使用mysql时type=InnoDB报错
- mysql中 的 ENGINE = innodb; 意思
- mysql中 的 ENGINE = innodb; 是什么意思
- mysql中 的 ENGINE = innodb; 是什么意思?
- mysql中engine=innodb和engine=myisam的区别
- mysql中engine=innodb和engine=myisam的区别
- mysql中engine=innodb和engine=myisam的区别
- mysql中engine=innodb和engine=myisam的区别
- mysql中engine=innodb和engine=myisam的区别
- Educational Codeforces Round 25
- 大数据基本概念(1)
- Mapreduce中的分区Partitioner
- 大数据基本概念
- 字节对齐和位域
- hibernate--MYSQL建表时type=InnoDB和Engine=InnoDB注意点
- Redux或mobx:给我们带来的革新
- mapreduce数据压缩
- Java高级之数据库编程
- c语言基础——指针数组
- The effect of parameter class_weight on linear SVM classifier
- `## 将一个整数插入到已经按从小到大排序好的整型数组里##
- CountDownLatch
- 暑假没有写题第八天