JPA、Hibernate、OneToMany 映射问题
给定父母:
@Entity
public class Discount {
@Id
private String id;
@Column(nullable = false)
private String userName;
@Column(nullable = false)
private String iDocId;
@Column(nullable = false)
private Date creationTime;
@Column(nullable = false)
private String salesOrganization;
.........
@OneToMany(cascade = CascadeType.ALL, mappedBy = "discount")
private Set<DiscountConditionScale> conditionScales = new HashSet<DiscountConditionScale>();
.........
}
和孩子:
@Entity
public class DiscountConditionScale {
@Id
@ManyToOne
private Discount discount;
private BigDecimal quantity;
private BigDecimal rate;
.......
}
我想让 DiscountConditionScale 的键为(折扣、费率、数量)。我该如何做到这一点?
非常感谢