使用apache derby和hbm2ddl的约束问题 [英] constraint problems using apache derby and hbm2ddl

查看:115
本文介绍了使用apache derby和hbm2ddl的约束问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Hibernate 3.3.x中使用Apache Derby 10.5.3.0_1和hbm2ddl

在嵌入式德比预加载SQL时,出现以下约束错误数据库。如果我从create table sql中删除主键(id),它可以创建表。不知道这里有什么问题。

  create table user_flow(id integer not null generated as identity unique,creation_date timestamp not null,name varchar(255),主键(id)); 

[信息]约束'SQL100219175052781'和'SQL100219175052780'具有相同的一组列,这是不允许的。


解决方案

这是 DERBY-789 ,我相信并且尚未修复。基本问题是该列被声明为'unique'和'主键',这导致Derby尝试创建两个约束索引。因为'主键'已经暗示'独特',所以你可以省略'唯一',我认为,比省略'主键'更好。


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.

解决方案

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'.

这篇关于使用apache derby和hbm2ddl的约束问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆