0

I am working on a product that uses hibernate (4.2) and mysql (Amazon RDS). the schema is updated via liquibase whenever a change is made. it also hosts many tanents through different schemas in the same DB instance. each time a new customer is registered a new schema is built. two things should happen:

1) create the schema

2) fill the schema with static data

currently, the schema update is done by hibernate (hbm2ddl update) and the filling of static data is done by code. I don't like both solutions as I understand hbm is limited and I don't like static data changes to be code related.

are there any suggestions on how to tackle this issue?

rperez
  • 8,430
  • 11
  • 36
  • 44

1 Answers1

0

It's always recommended to generate the schema manually, preferably by a tool supporting database schema revisions, such as the great Liquibase. Generating the schema from the entities is great in theory, but were fragile in practice and causes lots of problems in the long run(trust me on this).

Hibernate/JPA DB Schema Generation Best Practices

I can paste this link as comment but most probably this would be an answer.

Community
  • 1
  • 1
Suresh Atta
  • 120,458
  • 37
  • 198
  • 307