?
Solved

Hibernate error invalid identifier

Posted on 2009-07-08
3
Medium Priority
?
662 Views
Last Modified: 2013-12-02
Hi!

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?

Thanks!


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

Open in new window

0
Comment
Question by:Fionageo80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Assisted Solution

by:jwenting
jwenting earned 80 total points
ID: 24810911
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.
0
 

Author Comment

by:Fionageo80
ID: 24821232
Thanks.
0
 
LVL 2

Accepted Solution

by:
ethnarch earned 1920 total points
ID: 24855325
Java annotations can not be inherited,  you would have to respecify them in the derived class.

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question