package sklep.model;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the photos database table.
 * 
 */
@Embeddable
public class PhotoPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(name="product_id", insertable=false, updatable=false)
	private Integer productId;

	private Integer nr;

	public PhotoPK() {
	}
	public Integer getProductId() {
		return this.productId;
	}
	public void setProductId(Integer productId) {
		this.productId = productId;
	}
	public Integer getNr() {
		return this.nr;
	}
	public void setNr(Integer nr) {
		this.nr = nr;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof PhotoPK)) {
			return false;
		}
		PhotoPK castOther = (PhotoPK)other;
		return 
			this.productId.equals(castOther.productId)
			&& this.nr.equals(castOther.nr);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.productId.hashCode();
		hash = hash * prime + this.nr.hashCode();
		
		return hash;
	}
}