阅读背景:

如何使用注释指定列的组合应该是唯一约束?

来源:互联网 

I want to make sure that all rows in my table have a unique combination of two fields, and I want to specify this using annotations in my entity class. I have tried using a combination of @Table and @UniqueConstraint but apparently I'm doing it wrong, in that I can only seem to specify that the separate columns should be unique (I can already specify that using the @Column's unique property) rather than a combination of columns. For example I want a table which has fields A and B to contain only rows which have a unique combination of A and B. Neither field/column needs to be unique, it's the combination of the two which should be unique.I want to make sure that all rows in my table h




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: