Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse reports error on my JPA project

Each time I make a JPA project Eclipse reports that there are errors in my project but I do not understand why it does so. I added image and errors below:

enter image description here

Description Resource Path Location Type Column "id" cannot be resolved on table "page" Page.java /BreakpointJPA/src/no/breakpoint/domain line 14 JPA Problem

Description Resource Path Location Type Column "title" cannot be resolved on table "page" Page.java /BreakpointJPA/src/no/breakpoint/domain line 18 JPA Problem

Description Resource Path Location Type Primary key join column "id" cannot be resolved on table "page" Page.java /BreakpointJPA/src/no/breakpoint/domain line 10 JPA Problem

enter image description here

like image 512
LuckyLuke Avatar asked Oct 23 '11 11:10

LuckyLuke


People also ask

How do I check for errors in eclipse?

From the main menu, select Window > Show view > Other. Then select General > Error Log. The error log is displayed, showing the following information for each error: The status of the error (for example, error or warning)


1 Answers

I've had the same problem, the solution for me was to refresh the database connection.

Open the JPA view, find the data source explorer. There you open Database Connection, connect with your database, hit refresh. Then make some changes in your file and save it, i added an @Column(name = "") annotation to my id field. After that the error message was gone, and i ereased the Column annotation.

The Problem seems to be that eclipse reads the database tables after establishing the first connection, after that the connection is closed. So if you, like i did, made some changes after this first connection in your database, like changing the field name from foo_id to just id, eclipse didn't know that and comes with this error.

like image 160
Nils Avatar answered Oct 03 '22 19:10

Nils