When I make relationsships with JPA using hibernate, some terrible long and ackward column names are generated.
Eg. I have the following actionPlan_actionPlanPK, which means that the column actionPlan is a FK that points to actionPlanPK.
To make it look just a little bit more neat in the DB I would like if I could give it a name myself, preferably just the name it has in the entity class that owns the relationship.
Is this possible with JPA?
Yes. It is possible to specify your own name for a column if you are not satisfied with the default names. For instance in the class with the reference to the ActionPlan you can specify:
And thus, the column name will be ‘actionplanid’.