/* * The MIT License * * Copyright 2012 Universidad de Montemorelos A. C. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package mx.edu.um.mateo.contabilidad.model; import java.io.Serializable; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.JoinColumn; import javax.persistence.JoinColumns; import javax.persistence.ManyToOne; /** * * @author J. David Mendoza <jdmendoza@um.edu.mx> */ @Embeddable public class LibroPK implements Serializable { /** * */ private static final long serialVersionUID = -1372613922023722823L; @ManyToOne(optional = false) @JoinColumns({ @JoinColumn(name = "id_ejercicio"), @JoinColumn(name = "id_organizacion") }) private Ejercicio ejercicio; @Column(name = "id_libro", length = 2, nullable = false) private String idLibro; public LibroPK() { } public LibroPK(Ejercicio ejercicio, String idLibro) { this.ejercicio = ejercicio; this.idLibro = idLibro; } /** * @return the ejercicio */ public Ejercicio getEjercicio() { return ejercicio; } /** * @param ejercicio * the ejercicio to set */ public void setEjercicio(Ejercicio ejercicio) { this.ejercicio = ejercicio; } /** * @return the idLibro */ public String getIdLibro() { return idLibro; } /** * @param idLibro * the idLibro to set */ public void setIdLibro(String idLibro) { this.idLibro = idLibro; } @Override public int hashCode() { int hash = 3; hash = 71 * hash + Objects.hashCode(this.ejercicio); hash = 71 * hash + Objects.hashCode(this.idLibro); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final LibroPK other = (LibroPK) obj; if (!Objects.equals(this.ejercicio, other.ejercicio)) { return false; } if (!Objects.equals(this.idLibro, other.idLibro)) { return false; } return true; } }