Eclipse JPA Tools generating duplicate fields in Generate Entities from Tables

1k Views Asked by At

JPA Tools -> Generate Entities from Tables... results in duplicate fields:

dups

Predictably this results in this:

dups

Not shown are all the duplicated getters and setters. Deleting them is a pain, even for a small class like this.

I cannot see any easy option to fix this. Does anyone have any ideas why it's happening? Thanks in advance.

2

There are 2 best solutions below

0
dparikh On

This is true for mysql. I had three identical schemas with the same user table on mysql database instance. The entity created by the JPA Tools plugin had multiple fields with same name mapped to the multiple user tables in various schemas. Once I deleted all but one schema on the database, the tool retrieved correct list of fields that mapped to columns on the table

0
Jose Mena On

I had the same issue. I just renamed the other table in another schema. It seems that the Generate Entities from Table in Eclipse for a MySQL database looks for all tables with the same name no matter the schema.