Answer the question
In order to leave comments, you need to log in
How to create tables correctly with Hibernate?
I greet you dear!
Please help. I want to find an answer to how to create tables in an empty database (mysql) using Hibernate, is this possible and how expedient is it?
Are there any examples or links. I will be very grateful for your help!
Thank you.
Answer the question
In order to leave comments, you need to log in
Maybe. It is advisable if the models and relationships are more or less simple. You just need to set the property named "hbm2ddl.auto" to "update".
It is achieved by adding a line to the persistence.xml config:
You can also configure it programmatically, google how.
for myself I did this:
0) on the product and preproduction database for Hibernate there are no rights to change the schema. But there are such rights for Flyway, which already manages changes in the database schema
1) Hibernate has full rights to the developers' database and hbm2ddl.auto=update. flyway disabled
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question