-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: inheritance and mapping
PostPosted: Mon Oct 06, 2008 2:57 pm 
Newbie

Joined: Fri Sep 26, 2008 4:45 am
Posts: 17
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2008 5:19 am 
Newbie

Joined: Fri Sep 26, 2008 4:45 am
Posts: 17
As I understand you could not describe the discriminator value and have a getter / setter ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.