I get it to debug.
I take this with debug:
propertyMapping: _org_kyrian_entity_muvale_Prcontra_empresa
owner: Empre
In
Empre I've this code:
Code:
@OneToMany(mappedBy = "empresa")
private Collection<Prcontra> prcontraCollection;
Fields doc, nif in Empre:
Code:
@Column(name = "DOC", nullable = false)
private BigInteger doc;
@Column(name = "NIF", nullable = false)
private String nif;
PK in Empre:
Code:
@Id
@Column(name = "NUM", nullable = false)
@GeneratedValue(generator="SeqEmpre")
@SequenceGenerator(name="SeqEmpre",sequenceName="MUVALE.NUME", allocationSize=1)
private Long num;
In
PrContra,
Code:
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumns(
{
@JoinColumn(name = "DOC", referencedColumnName = "DOC",nullable=false),
@JoinColumn(name = "NIF", referencedColumnName = "NIF",nullable=false)
})
private Empre empresa;
Pk en Prcontra:
Code:
@EmbeddedId
protected PrcontraPK prcontraPK;
Bean PrcontraPK:
Code:
@Embeddable
public class PrcontraPK implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7441961985141369232L;
@Column(name = "NUMERO", nullable = false)
private BigInteger numero;
@Column(name = "RENOV", nullable = false)
private BigInteger renov;
@Column(name = "TIPO", nullable = false)
private BigInteger tipo;
public PrcontraPK() {
}
public PrcontraPK(BigInteger numero, BigInteger renov, BigInteger tipo) {
this.numero = numero;
this.renov = renov;
this.tipo = tipo;
}
public BigInteger getNumero() {
return numero;
}
public void setNumero(BigInteger numero) {
this.numero = numero;
}
public BigInteger getRenov() {
return renov;
}
public void setRenov(BigInteger renov) {
this.renov = renov;
}
public BigInteger getTipo() {
return tipo;
}
public void setTipo(BigInteger tipo) {
this.tipo = tipo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (numero != null ? numero.hashCode() : 0);
hash += (renov != null ? renov.hashCode() : 0);
hash += (tipo != null ? tipo.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof PrcontraPK)) {
return false;
}
PrcontraPK other = (PrcontraPK) object;
if (this.numero != other.numero && (this.numero == null || !this.numero.equals(other.numero))) {
return false;
}
if (this.renov != other.renov && (this.renov == null || !this.renov.equals(other.renov))) {
return false;
}
if (this.tipo != other.tipo && (this.tipo == null || !this.tipo.equals(other.tipo))) {
return false;
}
return true;
}
@Override
public String toString() {
return "org.kyrian.entity.muvale.PrcontraPK[numero=" + numero + ", renov=" + renov + ", tipo=" + tipo + "]";
}
}