cancel
Showing results for 
Search instead for 
Did you mean: 

JPA: Table generation from entity -> missing column?

former_member190457
Contributor
0 Kudos

Hi all,

in my project I have two jpa entity classes:

Employee is in a ManytoOne relationship with Company.

Using NWDS tools this has been mapped using @JoinColumn annotation.

Next I have generated tables from entities using NWDS.

In my dictionary project everything looks fine: Employee table has a Company_id field, referring to Company id field.

Unfortunately when I try to use the entity manager after deploying ear and dictionary I get:

 
Caused by: java.lang.RuntimeException: The persistence unit is inconsistent with the database schema:
Error on attribute >>my.test.Employee.company<<: The column >>EMPLOYEE.company_id<< does not exist.

However the column is actually there in the dictionary project. Deployment is succesful.

I have tried to change names, restart, redeploy whatever but to no use.

Can anyone help?

Thanks, regards

Vincenzo

Accepted Solutions (0)

Answers (1)

Answers (1)

rolf_paulsen
Active Participant
0 Kudos

Hi Vincenzo,

it can be a problem of upper/lower case (Company_id / company_id). You might have to explicity annotate the name of the column in lower (or complete upper) case in the @JoinColumn-annotation.

If it does not help: Which database? Did you check the column exists in the db? Can you post the src?

Greetings

Rolf

former_member190457
Contributor
0 Kudos

Hi, thanks for your reply,

the "missing" column was there but

actually I was not deploying the table the "missing" column was referring to.

Probably this got in the way, as all the project was a workaround to map existing tables to a proper object model.

Thanks, regards

Vincenzo