我们在Hibernate 3.3.x中使用Apache Derby 10.5.3.0_1和hbm2ddl
在嵌入式derby数据库上预加载SQL时,出现以下约束错误。如果我从创建表sql中删除主键(id),则可以创建表。不知道问题在这里。
create table user_flow (id integer not null generated always as identity unique, creation_date timestamp not null, name varchar(255), primary key (id));
[INFO] Constraints 'SQL100219175052781' and 'SQL100219175052780' have the same set of columns, which is not allowed.
最佳答案
我相信这是DERBY-789,尚未修复。基本问题是该列被声明为“唯一”和“主键”,这导致Derby尝试创建两个约束索引。由于“主键”已经意味着“唯一”,因此您可以省略“唯一”,我认为这比省略“主键”更好。
关于hibernate - 使用Apache derby和hbm2ddl的约束问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2296293/