订单明细实体与订单实体是单向的多对一的关系,与产品是单向的多对一的关系。它的代码如下所示。
LineItemEO实体
@Entity
@Table(name = "tb_line_item")
public class LineItemEO implements java.io.Serializable {
public LineItemEO() {}
private Integer id;
/** 订单明细ID */
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
private Integer quantity;
/** 订单条目的数量 */
@Column(name = "quantity")
public Integer getQuantity() {
return this.quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
private ProductEO product;
/** 所订购的产品 */
@ManyToOne
@JoinColumn(name = "product_id")
public ProductEO getProduct() {
return product;
}
public void setProduct(ProductEO product) {
this.product = product;
}
}