0

我有以下@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不在上创建上述约束Asset

4

0 回答 0