How to introduce multi-column constraint with JPA annotations?
- by plouh
I am trying to introduce a multi-key constraint on a JPA-mapped entity:
public class InventoryItem {
@Id
private Long id;
@Version
private Long version;
@ManyToOne
@JoinColumn("productId")
private Product product;
@Column(nullable=false);
private long serial;
}
Basically (product, serial) pair should be…