Java – Hibernate: hbm2ddl.auto=update in production

hbm2ddlhibernatejava

Is it okay to run Hibernate applications configured with hbm2ddl.auto=update to update the database schema in a production environment?

Best Answer

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.