Could EclipseLink be causing a ORA-00957: duplicate column name error because of a @DiscriminatorColumn in a polymorphic entity?
I'm getting this exception in an attempt to persist an **entity** object in an Oracle database, and I only started getting this error after switching my JPA project to **EclipseLink 2.0** from **Hibernate**, and I'm using "entity **inheritance**" if this could have anything to do with it (which I highly suspect).

*

    Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00957: duplicate column name
    Error Code: 957
    Call: INSERT INTO SUREC (ID, PERSON_ID, SURECID, VERSIYONNO, FAZ, FORM_TARIH, DURUMKODU_ID, surecId) VALUES (...

*

The exception message suggests that SURECID is generated twice in the SQL which seems to be causing the *duplicate column* error, however surecId is defined once as a property and annotated as a discriminator column in the entity class: (see below)


The base entity class resembles:

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    @DiscriminatorColumn(name = "surecId")
    public class Surec implements java.io.Serializable {
    
        private static final long serialVersionUID = -6008473677883005878L;
        @Column(name = "ID")
        private Long id;
        @Basic(optional = false)
        @Column(name = "FAZ")
        private int faz;
        @Basic(optional = false)
        @Column(name = "FORM_TARIH")
        @Temporal(TemporalType.DATE)
        private Date formTarih;
        @Column(name = "PERSON_ID")
        private Integer personId;
        // @Column(name = "SURECID", updatable = false, length=17)
        @Column(updatable = false, length=17)
        private String surecId;
        @Column(name = "VERSIYONNO")
        private Long versiyonno;
        @JoinColumn(name = "DURUMKODU_ID", referencedColumnName = "ID")
        @ManyToOne
        private DurumKod durumKodu;
    
        public Surec() {
        }
    
        public Surec(String surecId) {
            this.surecId = surecId;
        }
    
        public Long getId() {
            return id;
        }
    
        public void setId(Long id) {
            this.id = id;
        }
        .
        .
        .
        public String getSurecId() {
            return surecId;
        }
    
        public void setSurecId(String surecId) {
            this.surecId = surecId;
        }
        .
        .
        .

I commented the "@Column(name=..." annotation jus to see if it could be causing the duplicate column error, but it didn't work out.

And below is the polymorphic entity extending *Surec.java* above:

    @Entity
    @DiscriminatorValue("atf")
    public class MailOrder extends Surec {
        private static final long serialVersionUID = 8333637555543614502L;
        
        @Column(name = "AMOUNT")
        private Double amount;
        @Basic(optional = false)
        @Column(name = "CURRENCY", length = 17)
        private String currency;
        @Column(name = "BANK")
        private String Bank;
        @Column(name = "ACCOUNT_ID", length = 31)
        private String accountId;
        @Column(name = "INVOICE_ID")
        private Integer invoiceId;
    
        public MailOrder() {
        }
    
        public MailOrder(String surecId) {
            super(surecId);
        }
    
        public String getCurrency() {
            return currency;
        }
        .
        .
        .

The error occurs when I try to persist this very sub-entity.
It doesn't override any property of its superclass, although I'm not sure if it's the constructor... 

Any advise to resolve the problem (and acknowledgement of any possible EclipseLink or Oracle (or my!) bug will be appreciated.
Could EclipseLink be causing a ORA-00957: duplicate column name error because of a @DiscriminatorColumn in a polymorphic entity?
===

I'm getting this exception in an attempt to persist an **entity** object in an Oracle database, and I only started getting this error after switching my JPA project to **EclipseLink 2.0** from **Hibernate**, and I'm using "entity **inheritance**" if this could have anything to do with it (which I highly suspect).

*

    Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-00957: duplicate column name
    Error Code: 957
    Call: INSERT INTO SUREC (ID, PERSON_ID, SURECID, VERSIYONNO, FAZ, FORM_TARIH, DURUMKODU_ID, surecId) VALUES (...

*

The exception message suggests that SURECID is generated twice in the SQL which seems to be causing the *duplicate column* error, however surecId is defined once as a property and annotated as a discriminator column in the entity class: (see below)


The base entity class resembles:

    @Entity
    @Inheritance(strategy=InheritanceType.JOINED)
    @DiscriminatorColumn(name = "surecId")
    public class Surec implements java.io.Serializable {
    
        private static final long serialVersionUID = -6008473677883005878L;
        @Column(name = "ID")
        private Long id;
        @Basic(optional = false)
        @Column(name = "FAZ")
        private int faz;
        @Basic(optional = false)
        @Column(name = "FORM_TARIH")
        @Temporal(TemporalType.DATE)
        private Date formTarih;
        @Column(name = "PERSON_ID")
        private Integer personId;
        // @Column(name = "SURECID", updatable = false, length=17)
        @Column(updatable = false, length=17)
        private String surecId;
        @Column(name = "VERSIYONNO")
        private Long versiyonno;
        @JoinColumn(name = "DURUMKODU_ID", referencedColumnName = "ID")
        @ManyToOne
        private DurumKod durumKodu;
    
        public Surec() {
        }
    
        public Surec(String surecId) {
            this.surecId = surecId;
        }
    
        public Long getId() {
            return id;
        }
    
        public void setId(Long id) {
            this.id = id;
        }
        .
        .
        .
        public String getSurecId() {
            return surecId;
        }
    
        public void setSurecId(String surecId) {
            this.surecId = surecId;
        }
        .
        .
        .

I commented the "@Column(name=..." annotation jus to see if it could be causing the duplicate column error, but it didn't work out.

And below is the polymorphic entity extending *Surec.java* above:

    @Entity
    @DiscriminatorValue("atf")
    public class MailOrder extends Surec {
        private static final long serialVersionUID = 8333637555543614502L;
        
        @Column(name = "AMOUNT")
        private Double amount;
        @Basic(optional = false)
        @Column(name = "CURRENCY", length = 17)
        private String currency;
        @Column(name = "BANK")
        private String Bank;
        @Column(name = "ACCOUNT_ID", length = 31)
        private String accountId;
        @Column(name = "INVOICE_ID")
        private Integer invoiceId;
    
        public MailOrder() {
        }
    
        public MailOrder(String surecId) {
            super(surecId);
        }
    
        public String getCurrency() {
            return currency;
        }
        .
        .
        .

The error occurs when I try to persist this very sub-entity.
It doesn't override any property of its superclass, although I'm not sure if it's the constructor... 

Any advise to resolve the problem (and acknowledgement of any possible EclipseLink or Oracle (or my!) bug will be appreciated.