com.salesmanager.core.model.order.orderproduct.OrderProduct Maven / Gradle / Ivy
package com.salesmanager.core.model.order.orderproduct;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.salesmanager.core.constants.SchemaConstant;
import com.salesmanager.core.model.generic.SalesManagerEntity;
import com.salesmanager.core.model.order.Order;
@Entity
@Table (name="ORDER_PRODUCT" , schema=SchemaConstant.SALESMANAGER_SCHEMA)
public class OrderProduct extends SalesManagerEntity {
private static final long serialVersionUID = 176131742783954627L;
@Id
@Column (name="ORDER_PRODUCT_ID")
@TableGenerator(name = "TABLE_GEN", table = "SM_SEQUENCER", pkColumnName = "SEQ_NAME", valueColumnName = "SEQ_COUNT", pkColumnValue = "ORDER_PRODUCT_ID_NEXT_VALUE")
@GeneratedValue(strategy = GenerationType.TABLE, generator = "TABLE_GEN")
private Long id;
@Column (name="PRODUCT_SKU") //yess !!! rename to code
private String sku;
@Column (name="PRODUCT_NAME" , length=64 , nullable=false)
private String productName;
@Column (name="PRODUCT_QUANTITY")
private int productQuantity;
@Column (name="ONETIME_CHARGE" , nullable=false )
private BigDecimal oneTimeCharge;
@JsonIgnore
@ManyToOne(targetEntity = Order.class)
@JoinColumn(name = "ORDER_ID", nullable = false)
private Order order;
@OneToMany(mappedBy = "orderProduct", cascade = CascadeType.ALL)
private Set orderAttributes = new HashSet();
@OneToMany(mappedBy = "orderProduct", cascade = CascadeType.ALL)
private Set prices = new HashSet();
@OneToMany(mappedBy = "orderProduct", cascade = CascadeType.ALL)
private Set downloads = new HashSet();
public OrderProduct() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public int getProductQuantity() {
return productQuantity;
}
public void setProductQuantity(int productQuantity) {
this.productQuantity = productQuantity;
}
public Order getOrder() {
return order;
}
public void setOrder(Order order) {
this.order = order;
}
public Set getOrderAttributes() {
return orderAttributes;
}
public void setOrderAttributes(Set orderAttributes) {
this.orderAttributes = orderAttributes;
}
public Set getPrices() {
return prices;
}
public void setPrices(Set prices) {
this.prices = prices;
}
public Set getDownloads() {
return downloads;
}
public void setDownloads(Set downloads) {
this.downloads = downloads;
}
public void setSku(String sku) {
this.sku = sku;
}
public String getSku() {
return sku;
}
public void setOneTimeCharge(BigDecimal oneTimeCharge) {
this.oneTimeCharge = oneTimeCharge;
}
public BigDecimal getOneTimeCharge() {
return oneTimeCharge;
}
}