Generate persistence classes from schema is...a bit crap

Is this still a work in progress? Generating JPA classes from a schema makes some very bizarre choices. For example, for database column named 'fooBar', the generated property is foobar. So it's going from a good choice in the db to a bad choice in Java, usually the opposite of what we expect!

Secondly, a lot of redundant annotations are generated. For example:

public String getPoop()

In this case, there's no point in having the @Column annotation, as the spec says to assume the column name is poop by default.

Finally, the mapper seems to be utterly clueless when it comes to many to many relations, and instead tries to generate bizarre entities for the join tables. It should detect tables that are composed purely of foreign keys and map them correctly.


How do you get to this functionality. I used to be able to find it, but I have to create them by hand right now.

I can see why they would generate the column annotations. This allows you to rename the property in the class without breaking the connection. Maybe make this smarter (give a choice to always annotate or annotate when different and add when the field changes).


Yep, its impossible to find alright.

You have to add a JPA facet, then somehow find its properties in one of the project views, and you'll find that magical generate persistence mappings context menu.


Please sign in to leave a comment.