Hi,
I got the following exception while I'm trying to deploy my application
Code:
org.hibernate.MappingException: Repeated column in mapping for entity: ch.btc.datec.yamina.model.TypeAffaire column: typeCode (should be mapped with insert="fal
se" update="false")
with the following mapping and entity
Code.java
Code:
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
name="typeCode",
discriminatorType=DiscriminatorType.STRING
)
public class Code implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private long id;
@Column(name = "typeCode", length = 3, nullable = true)
private String typeCode;
@Column(name = "code", length = 50, nullable = true)
private String code;
@Column(name = "libCourtFR", length = 20, nullable = true)
private String libelleCourtFr;
@Column(name = "libCourtDE", length = 20, nullable = true)
private String libelleCourtDe;
@Column(name = "libLongFR", length = 20, nullable = true)
private String libelleLongFr;
@Column(name = "libLongDE", length = 20, nullable = true)
private String libelleLongDe;
/**
* Constructor
*/
public Code () {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLibelleCourtFr() {
return libelleCourtFr;
}
public void setLibelleCourtFr(String libelleCourtFr) {
this.libelleCourtFr = libelleCourtFr;
}
public String getLibelleCourtDe() {
return libelleCourtDe;
}
public void setLibelleCourtDe(String libelleCourtDe) {
this.libelleCourtDe = libelleCourtDe;
}
public String getLibelleLongFr() {
return libelleLongFr;
}
public void setLibelleLongFr(String libelleLongFr) {
this.libelleLongFr = libelleLongFr;
}
public String getLibelleLongDe() {
return libelleLongDe;
}
public void setLibelleLongDe(String libelleLongDe) {
this.libelleLongDe = libelleLongDe;
}
/* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
return EqualsBuilder.reflectionEquals(this, obj);
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public int hashCode() {
return HashCodeBuilder.reflectionHashCode(this);
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
Code:
@Entity
@DiscriminatorValue("TRT")
public class TypeAffaire extends Code implements Serializable {
/**
* Constructor
*/
public TypeAffaire () {
}
}
is that because I'already defined the column typeCode as the descriminator inside my entity definition ? (I'm not at work so I couldn't test)
thanks in advance