Hibernate error invalid identifier


I have an abstract class called AbstractMuni where I specified the @ muniNr then in the subclass I want to specify the name of the column @ muniNr

I have to overrite it but it doesn´t do that and when I create a second variable inside of MuniCz called:
@Column(name="Muni_NR", updatable=false , insertable=false)
 protected Integer MuniNr

When I do this I get the real name Muni_NR but also muniNr, one from the subclass and the other from the abstractclass, and I get the error: ERROR [JDBCExceptionReporter] ORA-00904: "muniNr": invalid identifier

How can I overrite the name of the column?


@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class AbstractMuni implements Serializable {
     * Make eclipse happy.
    private static final long serialVersionUID = -5317164811803141763L;
    @Column(name = "muniNr")
    protected Integer muniNr;
     public abstract Integer getMuniNr();
      public abstract void setMuniNr(Integer muniNr);
@Table(name = "Municipalities")
@AttributeOverride(name = "muniNr", column = @Column(name = "Muni_NR"))
public class MuniCz extends AbstractMuni implements Serializable {
    public Integer getMuniNr() {
        return districtNr;
    public void setMuniNr(Integer muniNr) {
        this.muniNr = muniNr;

Open in new window

Who is Participating?
ethnarchConnect With a Mentor Commented:
Java annotations can not be inherited,  you would have to respecify them in the derived class.

jwentingConnect With a Mentor Commented:
You can't.

And it's overwrite, not overrite. Pay attemtion to spelling, it helps prevent code errors as well to be precise in all your languages.
Fionageo80Author Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.