JPA / EclipseLink - 在启动时创建/更新表期间创建的不良外键

时间:2012-05-20 05:12:23

标签: java jpa-2.0 eclipselink

我有以下@Entity

@Entity
public class Asset {

  @Id
  private long id;

  @Enumerated(EnumType.STRING)
  private TagType tagType;

  private String tagId;

  @OneToOne(cascade = CascadeType.ALL, optional = true, orphanRemoval = true)
  @JoinColumns(value = {
    @JoinColumn(name = "tagId", referencedColumnName = "tagId", nullable = true, insertable = false, updatable = false),
    @JoinColumn(name = "tagType", referencedColumnName = "tagType", nullable = true, insertable = false, updatable = false)})
  private TagInfo tagInfo;

  ...
}

@Entity
public class TagInfo {

    @Id
    private String tagId

    @Id
    private TagType tagType

    ...     
}

当EclipseLink开始使用"eclipselink.ddl-generation" = "drop-and-create-tables"时,它会创建具有以下约束的ASSET表:

CONSTRAINT FK_ASSET_TAGTYPE FOREIGN KEY(TAGTYPE,TAGID) REFERENCES TAGINFO(TAGTYPE,TAGID))

有没有让EclipseLink NOT Asset表上创建上述约束?

0 个答案:

没有答案