假设有一个具有唯一约束的 Model bean,它结合了两列(作为复合主键),如下所示:
@Entity
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "key1", "key2" }) })
public class Rating extends Model {
@ManyToOne
@JoinColumn(name="key1", nullable=false)
public Post key1;
@ManyToOne
@JoinColumn(name="key2", nullable=false)
public User key2;
...
}
如何找到具有以下签名的方法的查找器:
public static Rating get(Post key1, User key2) { ... }