package org.xmx0632.deliciousfruit.entity; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.validation.constraints.NotNull; import org.apache.commons.lang3.builder.ToStringBuilder; /** * OrderProduct. */ @Entity @Table(name = "tbl_order_product") public class OrderProduct extends IdEntity { private Order order; private String productId; private String productName; private Integer quantity; public OrderProduct() { } public OrderProduct(Order order, String productId) { this.order = order; this.productId = productId; } @ManyToOne @JoinColumn(name = "order_id") public Order getOrder() { return order; } public void setOrder(Order order) { this.order = order; } @NotNull public String getProductId() { return this.productId; } public void setProductId(String productId) { this.productId = productId; } public String getProductName() { return this.productName; } public void setProductName(String productName) { this.productName = productName; } public Integer getQuantity() { return this.quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } }