举例:
实体对象 order,通过 refundOrderId关联于 RefundOrderItem表,在新建实体 order中 ,同时需要新建 refundOrderItems,这样如果只是保存order实体,refundOrderItems也会保存信息,但是在RefundOrderItem表上并没有数据。
ps:在实体中的级联级别为 All
@OneToMany(cascade = {CascadeType.ALL,CascadeType.PERSIST,
CascadeType.REMOVE }, fetch = FetchType.EAGER)
@JoinColumn(name="refundOrderId",referencedColumnName ="refundOrderCode")
private List<RefundOrderItem> refundOrderItems;
原文:http://17099933344.blog.51cto.com/12891875/1931069