Solved

Hibernate error invalid identifier

Posted on 2009-07-08
3
656 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
3 Comments
 
LVL 6

Assisted Solution

by:jwenting
jwenting earned 20 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 480 total points
ID: 24855325
Java annotations can not be inherited,  you would have to respecify them in the derived class.

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java jdbc batch example 8 41
Is Applet the way to go for my drag and drop system? 8 25
Html Table Looping (part 2) 5 27
swing controls 2 16
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

831 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