hr.softwarecity.osijek.model.CommentPK.java Source code

Java tutorial

Introduction

Here is the source code for hr.softwarecity.osijek.model.CommentPK.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package hr.softwarecity.osijek.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

/**
 *
 * @author Leon
 */
@Embeddable
public class CommentPK implements Serializable {

    @ManyToOne
    @JsonIgnore
    private Washmachine product;
    @ManyToOne
    private Person person;

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 23 * hash + Objects.hashCode(this.product);
        hash = 23 * hash + Objects.hashCode(this.person);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CommentPK other = (CommentPK) obj;
        return true;
    }

    public Washmachine getProduct() {
        return product;
    }

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

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

}