请问这句hibernate生成的sql为什么出错啊,谢谢

来源:百度知道 编辑:UC知道 时间:2024/05/16 07:06:26
17:42:38,663 DEBUG SchemaExport:377 -
create table Product (
id integer not null auto_increment,
brand varchar(255),
desc varchar(255),
name varchar(255),
price integer not null,
primary key (id)
)
17:42:38,666 ERROR SchemaExport:348 - Unsuccessful: create table Product (id integer not null auto_increment, brand varchar(255), desc varchar(255), name varchar(255), price integer not null, primary key (id))
17:42:38,668 ERROR SchemaExport:349 - 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 'desc varchar(255), name varchar(255), price integer not null, primary key (id))' at line 1
17:42:38,669 INFO SchemaExport:268 - schema export complete

没用过MySQL,不晓得是否是desc为保留关键字的问题!

desc varchar(255),
这里使用了关键字 desc所以错了
可以修改为:
descn varchar(255),
就可以了~

可能是数据库方言错误,要在配置文件中选择你所用的数据库类型,跟sql语句无关系。