constraint problems using apache derby and hbm2ddl

不问归期 提交于 2019-12-11 14:07:40

问题


We are using Apache Derby 10.5.3.0_1 and hbm2ddl with Hibernate 3.3.x

I get the following constraints error while pre-loading the SQL on an embedded derby database. If I remove the primary key(id) from the create table sql, it's able to create the table. Not sure what the problem is over here.

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.

回答1:


This is DERBY-789, I believe, and has not yet been fixed. The basic issue is that the column is declared as both 'unique' and 'primary key', which causes Derby to try to create two constraint indexes. Since 'primary key' already implies 'unique', you can just omit the 'unique', which is, I think, better than omitting the 'primary key'.



来源:https://stackoverflow.com/questions/2296293/constraint-problems-using-apache-derby-and-hbm2ddl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!