anssias
anssias

Reputation: 2074

Is there a way to migrate JPA table names with Hibernate?

I have JPA table annotations and I would like to change some table names to follow a specific naming convention. The problem is that those tables are already in production. I don't like the idea of manually creating a new table and inserting the data because I have no idea how to deal with id's and associations.

What is the best way to approach this problem?

Edit: I am using hibernate.hbm2ddl.auto=update.

Upvotes: 2

Views: 821

Answers (1)

Vlad Mihalcea
Vlad Mihalcea

Reputation: 153810

  1. You need a migration production script that does an:

    RENAME TABLE ....

  2. You modify the entity table mappings to match the new table names

  3. You do a production update that does both 1) and 2)

Upvotes: 2

Related Questions