SellingPriceListProduct.java

package com.tradecloud.domain.item;

import com.tradecloud.common.base.PersistenceBase;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.math.BigDecimal;

@Entity
@Table(name = "sellingpricelistproduct")
@Access(AccessType.FIELD)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "SellingPriceListProducts")
public class SellingPriceListProduct extends PersistenceBase {

    private static final long serialVersionUID = 1L;

    @ManyToOne
    private SellingPriceList sellingPriceList;

    @ManyToOne
    private Product product;

    private BigDecimal sellingPrice;

    public SellingPriceList getSellingPriceList() {
        return sellingPriceList;
    }

    public void setSellingPriceList(SellingPriceList sellingPriceList) {
        this.sellingPriceList = sellingPriceList;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public BigDecimal getSellingPrice() {
        return sellingPrice;
    }

    public void setSellingPrice(BigDecimal sellingPrice) {
        this.sellingPrice = sellingPrice;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + ((product == null) ? 0 : product.hashCode());
        result = prime * result + ((sellingPrice == null) ? 0 : sellingPrice.hashCode());
        result = prime * result + ((sellingPriceList == null) ? 0 : sellingPriceList.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (!super.equals(obj))
            return false;
        if (getClass() != obj.getClass())
            return false;
        SellingPriceListProduct other = (SellingPriceListProduct) obj;
        if (product == null) {
            if (other.product != null)
                return false;
        } else if (!product.equals(other.product))
            return false;
        if (sellingPrice == null) {
            if (other.sellingPrice != null)
                return false;
        } else if (!sellingPrice.equals(other.sellingPrice))
            return false;
        if (sellingPriceList == null) {
            if (other.sellingPriceList != null)
                return false;
        } else if (!sellingPriceList.equals(other.sellingPriceList))
            return false;
        return true;
    }
}