ERROR: HHH000388: Unsuccessful: create table
来源:互联网 发布:网络安全书 编辑:程序博客网 时间:2024/06/01 18:56
参考:http://blog.csdn.net/hncmkl/article/details/48272149
做SSH整合的时候,总是出现错误信息:
类似这样:
: HHH000388: Unsuccessful: create table right (right_code varchar(255) not null auto_increment, right_desc varchar(255), right_name varchar(255), right_parent_code varchar(255), right_type varchar(255), right_url varchar(255), primary key (right_code)) ENGINE=InnoDB九月 07, 2015 6:22:44 下午 org.hibernate.tool.hbm2ddl.SchemaUpdate executeERROR: 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 'right (right_code varchar(255) not null auto_increment, right_desc varchar(255),' at line 1
我的表其中一个字段是:
/* * 宝贝的描述 */@Column(name = "desc", nullable = false, length = 255)private String desc;
错误是因为字段名和数据库关键字冲突了!!!
在网站找到的一些mysql关键字,注意避免将其用作字段名:
参考: http://www.cnblogs.com/-mrl/p/6021959.html
如果非要在hibernate中使用数据库关键字(保留字),解决方法可以是:
参考: http://blog.csdn.net/henren555/article/details/10252223
两种方式:
- 使用[]
<property name="desc" type="string" > <column name="[DESC]" length="255" not-null="true" /></property>
注解
@Column(name = "[DESC]", nullable = false)public String getDesc() { return this.desc;}
2,使用单引号包围双引号
<property name="desc" type="string" > <column name='"DESC"' length="255" not-null="true" /></property>
注解
@Column(name = "\"DESC\"", nullable = false)public String getDesc() { return this.desc;}
1 0
- ERROR: HHH000388: Unsuccessful: create table
- ERROR: HHH000388: Unsuccessful: create table right (right_code varchar(255) not null auto_increment,
- hibernate生成数据表时报错:HHH000388: Unsuccessful: create table emp (empid integer generated by default as i
- H2和Hibernate:ERROR: org.hibernate.tool.hbm2ddl.SchemaUpdate - Unsuccessful: create table
- hibernate遇到Unsuccessful: create table问题
- [org.hibernate.tool.hbm2ddl.SchemaUpdate] - Unsuccessful: create table
- Hibernate4:遇到无法建表问题 Unsuccessful: create table
- hibernate生成数据表时报错: Unsuccessful: create table NEWS (ID integer not null auto_increment, TITLE varcha
- create table with xml error
- error: hive create table failed
- Mysql create table Error:1005
- hibernate无法自动建表:ERROR: HHH000388
- ERROR 1005: Can't create table
- MYSQL ERROR 1005:cannot create table 解决方案
- hibernate4.x自动建表时候创建外键失败ERROR: HHH000389: Unsuccessful: alter table ORDERS_NOPK1 add index
- mysql ERROR: Error 1005: Can't create table (errno: 121)
- Mysql create table failure: ERROR 1005 (HY000): Can't create table 'lams.attendance1' (errno: 121)
- create table
- poj 3348 Cows (凸包面积)
- makefile简介与入门
- 数据库灾难...
- Java's HelloWorld
- 文章标题
- ERROR: HHH000388: Unsuccessful: create table
- Android 滑动返回上一级页面
- 无缝动画原理
- matlab 形态学函数的应用
- Python's HelloWorld
- 远程登录linux的mysql数据库常见问题解决方法参考
- View滑动效果常用属性详解2-使用scrollX|scrollY和Scroller实现自定义ViewPager
- 字符串
- iOS多线程编程GCD