/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cookery_db.database;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;


/**
 *
 * @author nick
 */
@Embeddable
public class RecipeIngredientPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "RECIPE")
    private int recipe;
    @Basic(optional = false)
    @Column(name = "INGREDIENT")
    private int ingredient;

    public RecipeIngredientPK()
    {
    }

    public RecipeIngredientPK(int recipe, int ingredient)
    {
        this.recipe = recipe;
        this.ingredient = ingredient;
    }

    public int getRecipe()
    {
        return recipe;
    }

    public void setRecipe(int recipe)
    {
        this.recipe = recipe;
    }

    public int getIngredient()
    {
        return ingredient;
    }

    public void setIngredient(int ingredient)
    {
        this.ingredient = ingredient;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (int) recipe;
        hash += (int) ingredient;
        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 RecipeIngredientPK))
        {
            return false;
        }
        RecipeIngredientPK other = (RecipeIngredientPK) object;
        if (this.recipe != other.recipe)
        {
            return false;
        }
        if (this.ingredient != other.ingredient)
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "cookery_db.database.RecipeIngredientPK[recipe=" + recipe + ", ingredient=" + ingredient + "]";
    }

}
