播放或JPA为我的表添加唯一约束

时间:2014-04-09 12:53:14

标签: postgresql jpa playframework-2.0

我在Playframework 2.1.5中的两个模型之间有一对多的关系。这是代码:

@OneToMany(cascade={CascadeType.PERSIST, CascadeType.REMOVE})
public List<OperationInstance> operations;

数据库是Postgres 9.2。

生成的连接表包含数千个(精确度超过3000个)唯一约束:

  CREATE TABLE monthly_operationinstance
  (
    monthly_id bigint NOT NULL,
    operations_id bigint NOT NULL,
  CONSTRAINT fk_12cd68e7976a4cc59958b9cbaed FOREIGN KEY (operations_id)
        REFERENCES operationinstance (id) MATCH SIMPLE
        ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT fk_1c9bfd55e99b4851ac893c32f86 FOREIGN KEY (monthly_id)
        REFERENCES monthly (id) MATCH SIMPLE
        ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT uk_0003c989137b4707bf686ccce14 UNIQUE (operations_id),
  CONSTRAINT uk_0007f093bce04ff9831e3765a39 UNIQUE (operations_id),
  CONSTRAINT uk_000994722b6c4eecac47b54fa84 UNIQUE (operations_id),
  CONSTRAINT uk_006346e4144f4646a06c79184ec UNIQUE (operations_id),
  ...

我已经创建了一个没有任何约束的新数据库,并且在启动应用程序后2分钟我在此表上有3个新约束。关于谁生成这些以及为什么会有什么建议吗?

0 个答案:

没有答案