Incorrect column specifier for column 'addressId'
随风飘扬 学习 2015年10月03日3:20 3036
用Hibernate生成数据表时,Hibernate执行了下面的SQL语句: create t
用Hibernate生成数据表时,Hibernate执行了下面的SQL语句:
create table Address (addressId varchar(255) not null auto_increment, name varchar(255), primary key (addressId))
用了log4j检查:hibernat提示以下错误:
10:56:24,546 ERROR SchemaExport:274 - Unsuccessful: create table Address (addressId varchar(255) not null auto_increment, name varchar(255), primary key (addressId))
10:56:24,546 ERROR SchemaExport:275 - Incorrect column specifier for column 'addressId'
原来自动增长列用int数据类型,不用varchar.
Hibernate根据Address.java中的代码
private String addressId;
private String name;
这样指定了“addressId varchar(255) not null auto_increment”
改为别的,要是自动增长列,要么将addressId改为Integer类型,或者将映射文件改为 其他主键生成策略。
Statement: all articles / drawings reproduced on this website are for the purpose of transmitting more information and facilitating discussion, which does not mean that the website, the host and the organizer agree with their opinions or confirm the authenticity of their contents. The contents of the articles are for reference only. If the rights of the original author are violated, please contact the website administrator.
Comment list
-
No data