/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jpa.demo;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;

/**
 *
 * @author Administrator
 */
@Entity
public class MyOrder implements Serializable {
    private static final long serialVersionUID = 1L;
   @EmbeddedId 
   OrderID oid;

   
  
    private int quantity;
    private double price;

    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (oid != null ? oid.hashCode() : 0);
        return hash;
    }

    public OrderID getOid() {
        return oid;
    }

    public void setOid(OrderID oid) {
        this.oid = oid;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    @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 Student)) {
            return false;
        }
       MyOrder other = (MyOrder) object;
        if ((this.oid == null && other.oid != null) || (this.oid != null && !this.oid.equals(other.oid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jpa.demo.Oder[ id=" + oid + " ]";
    }
}

