1
是否可以對javax.persistence庫中的嵌入式實體有一個唯一的約束,而不必單獨提及所有列?對嵌入式實體的唯一約束?
我有什麼:
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "someReference", "id1", "id2" }) })
public class A {
@Embedded
private B embedded;
private String someReference;
}
@Embeddable
public class B {
private long id1;
private long id2;
}
我想要什麼(或多或少):
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = {"someReference", "embedded" }) })