/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package stockInformation; import java.io.Serializable; import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; /** * * @author eve */ @IdClass(stockInformation.OrdlinementKey.class) @Entity @Table(name="ORDERLINE") public class Ordlineent implements Serializable { private static final long serialVersionUID = 1L; //@Id //@Column(name = "ITEMID", nullable = false, insertable=false, updatable=false) //private Long itmid; //@Id //@Column(name = "CUSID", nullable = false, insertable=false, updatable=false) //private Long cusid; //@Id // @Column(name = "ORDID", nullable = false, insertable=false, updatable=false) //private Long ordID; //@EmbeddedId //private OrdlinementKey ordlinementKey; @ManyToOne(cascade = {CascadeType.ALL}) @JoinColumn(name="ORDID") private Orderent orderent; @ManyToOne(cascade = {CascadeType.ALL}) @JoinColumn(name="ITMID") private Iteamdetailsent iteamdetailsent; @ManyToOne(cascade = {CascadeType.ALL}) // @JoinColumn(name="CUSID") private Customerent customerent; @Column(name="QUANTITY", nullable=true) private int quanity; /** public OrdlinementKey getOrdlinementKey(){ return ordlinementKey;} public void setOrdlinementKey(OrdlinementKey ordlinementKey){ this.ordlinementKey=ordlinementKey;} /** public Long getItmid(){ return itmid;} public void setItmid(Long itmid){ this.itmid=itmid;} /** public Long getCusid() {return cusid;} public void setCusid(Long cusid){ this.cusid=cusid; } public Long getOrdID(){ return ordID;} public void setOrdID(Long ordID){ this.ordID=ordID;} */ public Orderent getOrderent() { return orderent; } public void setOrderent(Orderent orderent) { this.orderent = orderent; } public Iteamdetailsent getIteamdetailsent() { return iteamdetailsent; } public void setIteamdetailsent(Iteamdetailsent iteamdetailsent) { this.iteamdetailsent = iteamdetailsent; } // public Customerent getCustomerent() { //return customerent; //} //public void setCustomerent(Customerent customerent) { // this.customerent = customerent; //} public int getQuanity() { return quanity; } public void setQuanity(int quanity) { this.quanity = quanity; } /** @Override public int hashCode() { if (this.getOrderent() == null || this.getIteamdetailsent() == null) { return 0; } else { return (this.getOrderent().hashCode() ^ this.getIteamdetailsent().hashCode()); } } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Ordlineent other = (Ordlineent) obj; if (this.orderent != other.orderent && (this.orderent == null || !this.orderent.equals(other.orderent))) { return false; } if (this.iteamdetailsent != other.iteamdetailsent && (this.iteamdetailsent == null || !this.iteamdetailsent.equals(other.iteamdetailsent))) { return false; } if (this.customerent != other.customerent && (this.customerent == null || !this.customerent.equals(other.customerent))) { return false; } return true; } */ /** @Override public int hashCode() { int hash = 0; hash += (ordID != null ? ordID.hashCode() : 0); return hash; }*/ /** @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Ordlineent)) { return false; } Ordlineent other = (Ordlineent) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; }*/ @EmbeddedId @AttributeOverrides({ @AttributeOverride(name="ITMID" , column=@Column(name="itmid")), @AttributeOverride(name="CUSID" , column=@Column(name="cusid")), @AttributeOverride(name="ORDID" , column=@Column(name="ordID")) }) @Override public String toString() { return "stockInformation.Ordlineent[id=" + customerent + "]"; } }