提问人:SOJSON用户
提问日期:2020-03-28 16:09
热度:292
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table test (id varchar(255) not null, primary key (id)) engine=MyISAM" via JDBC Statement
创建失败了。
jpa:
show-sql: true # 显示sql
open-in-view: false
hibernate:
ddl-auto: update # 自动建表,更新表
1条回答
我来回答
soゝso|
2020-03-28 16:11
从错误来分析,主要是id的长度问题,他默认是255,然后ID是主键。
只要在实体上加上“@Column(length = 16)” 注解即可。如下代码:
@Id
@Column(length = 16)//设置ID长度为16个长度
private String id;