/******************************************************************************* * Copyright (c) 2011, 2015 Xavier Callejas. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 * which accompanies this distribution. * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * 07/11/2011-2.4 Xavier Callejas * - 343632: Can't map a compound constraint because of exception: * The reference column name [y] mapped on the element [field x] * does not correspond to a valid field on the mapping reference ******************************************************************************/ package org.eclipse.persistence.testing.models.jpa.ddlgeneration; import java.io.Serializable; import java.util.List; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author xavier */ @Entity @Table(name = "Clientes") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Clientes.findAll", query = "SELECT c FROM Clientes c")}) public class Clientes implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @NotNull @Column(name = "idCliente") private Integer idCliente; @Size(max = 45) @Column(name = "Nombre") private String nombre; @OneToMany(cascade = CascadeType.ALL, mappedBy = "cliente") private List<Operaciones> operacionesList; public Clientes() { } public Clientes(Integer idCliente) { this.idCliente = idCliente; } public Integer getIdCliente() { return idCliente; } public void setIdCliente(Integer idCliente) { this.idCliente = idCliente; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } @XmlTransient public List<Operaciones> getOperacionesList() { return operacionesList; } public void setOperacionesList(List<Operaciones> operacionesList) { this.operacionesList = operacionesList; } @Override public int hashCode() { int hash = 0; hash += (idCliente != null ? idCliente.hashCode() : 0); 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 Clientes)) { return false; } Clientes other = (Clientes) object; if ((this.idCliente == null && other.idCliente != null) || (this.idCliente != null && !this.idCliente.equals(other.idCliente))) { return false; } return true; } @Override public String toString() { return "org.test.model.jpa.Clientes[ idCliente=" + idCliente + " ]"; } }