Is it okay to run Hibernate applications configured with hbm2ddl.auto=update
to update the database schema in a production environment?
hbm2ddl. auto Automatically validates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly.
auto update : If the value is update then, Hibernate checks for the table and columns. If a table doesn't exist then it creates new tables and where as if a column doesn't exist it creates new columns for it.
You can set spring. jpa. hibernate. ddl-auto explicitly and the standard Hibernate property values are none , validate , update , create-drop .
No, it's unsafe.
Despite the best efforts of the Hibernate team, you simply cannot rely on automatic updates in production. Write your own patches, review them with DBA, test them, then apply them manually.
Theoretically, if hbm2ddl update worked in development, it should work in production too. But in reality, it's not always the case.
Even if it worked OK, it may be sub-optimal. DBAs are paid that much for a reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With