Rev 21924 | Rev 21988 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.fofo;import java.io.Serializable;import java.time.LocalDateTime;import java.util.List;import javax.persistence.CascadeType;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.FetchType;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.JoinColumn;import javax.persistence.ManyToOne;import javax.persistence.NamedQueries;import javax.persistence.NamedQuery;import javax.persistence.OneToMany;import javax.persistence.Table;@Entity@Table(name="fofo.fofo_order", schema = "fofo")@NamedQueries({@NamedQuery(name = "FofoOrder.selectCount", query = "select count(fo) from FofoOrder fo"),@NamedQuery(name = "FofoOrder.selectById", query = "select fo from FofoOrder fo where fo.id = :id"),@NamedQuery(name = "FofoOrder.selectByFofoId", query = "select fo from FofoOrder fo where fo.fofoId = :fofoId"),@NamedQuery(name = "FofoOrder.selectTotolAmountByFofoId", query = "select sum(fo.totalAmount) from FofoOrder fo where fo.fofoId = :fofoId group by fo.fofoId"),@NamedQuery(name = "FofoOrder.selectByInvoiceNumber", query = "select fo from FofoOrder fo where fo.invoiceNumber = :invoiceNumber")})public class FofoOrder implements Serializable{private static final long serialVersionUID = 1L;@Id@Column(name = "id")@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;@Column(name = "fofo_id")private int fofoId;@Column(name = "customer_id")private int customerId;@Column(name = "customer_address_id")private int customerAddressId;@Column(name = "total_amount")private float totalAmount;@Column(name = "invoice_number", length = 50)private String invoiceNumber;@Column(name = "create_timestamp")private LocalDateTime createTimestamp = LocalDateTime.now();@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)@JoinColumn(name="order_id",insertable=false,updatable=false,nullable=false)private List<FofoLineItem> fofoLineItem;@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());result = prime * result + ((customer == null) ? 0 : customer.hashCode());result = prime * result + customerAddressId;result = prime * result + customerId;result = prime * result + fofoId;result = prime * result + ((fofoLineItem == null) ? 0 : fofoLineItem.hashCode());result = prime * result + id;result = prime * result + ((invoiceNumber == null) ? 0 : invoiceNumber.hashCode());result = prime * result + ((paymentOption == null) ? 0 : paymentOption.hashCode());result = prime * result + Float.floatToIntBits(totalAmount);return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;FofoOrder other = (FofoOrder) obj;if (createTimestamp == null) {if (other.createTimestamp != null)return false;} else if (!createTimestamp.equals(other.createTimestamp))return false;if (customer == null) {if (other.customer != null)return false;} else if (!customer.equals(other.customer))return false;if (customerAddressId != other.customerAddressId)return false;if (customerId != other.customerId)return false;if (fofoId != other.fofoId)return false;if (fofoLineItem == null) {if (other.fofoLineItem != null)return false;} else if (!fofoLineItem.equals(other.fofoLineItem))return false;if (id != other.id)return false;if (invoiceNumber == null) {if (other.invoiceNumber != null)return false;} else if (!invoiceNumber.equals(other.invoiceNumber))return false;if (paymentOption == null) {if (other.paymentOption != null)return false;} else if (!paymentOption.equals(other.paymentOption))return false;if (Float.floatToIntBits(totalAmount) != Float.floatToIntBits(other.totalAmount))return false;return true;}@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.LAZY)@JoinColumn(name="order_id",insertable=false,updatable=false,nullable=false)private List<PaymentOption> paymentOption;public List<PaymentOption> getPaymentOption() {return paymentOption;}public void setPaymentOption(List<PaymentOption> paymentOption) {this.paymentOption = paymentOption;}public List<FofoLineItem> getFofoLineItem() {return fofoLineItem;}public void setFofoLineItem(List<FofoLineItem> fofoLineItem) {this.fofoLineItem = fofoLineItem;}@ManyToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)@JoinColumn(name="customer_id",insertable=false,updatable=false,nullable=false, referencedColumnName="id")private Customer customer;public Customer getCustomer() {return customer;}public void setCustomer(Customer customer) {this.customer = customer;}public int getId() {return id;}public void setId(int id) {this.id = id;}public int getFofoId() {return fofoId;}public void setFofoId(int fofoId) {this.fofoId = fofoId;}public int getCustomerId() {return customerId;}public void setCustomerId(int customerId) {this.customerId = customerId;}public int getCustomerAddressId() {return customerAddressId;}public void setCustomerAddressId(int customerAddressId) {this.customerAddressId = customerAddressId;}public float getTotalAmount() {return totalAmount;}public void setTotalAmount(float totalAmount) {this.totalAmount = totalAmount;}public String getInvoiceNumber() {return invoiceNumber;}public void setInvoiceNumber(String invoiceNumber) {this.invoiceNumber = invoiceNumber;}public LocalDateTime getCreateTimestamp() {return createTimestamp;}public void setCreateTimestamp(LocalDateTime createTimestamp) {this.createTimestamp = createTimestamp;}@Overridepublic String toString() {return "FofoOrder [id=" + id + ", fofoId=" + fofoId + ", customerId=" + customerId + ", customerAddressId="+ customerAddressId + ", totalAmount=" + totalAmount + ", invoiceNumber=" + invoiceNumber+ ", createTimestamp=" + createTimestamp + ", fofoLineItem=" + fofoLineItem + ", paymentOption="+ paymentOption + ", customer=" + customer + "]";}}