For what it's worth, NEVER ever use hbm2ddl.auto in any live / production database.
Yes, it "works as intended" that the "update" does not leave any columns that are not referenced (it is possible that you can use the "obsolete" databases that have columns that are not used by your hibernate application, but can be used external applications). However, under certain circumstances, hibernation can drop and recreate columns if, for example, you change the data type in your object. This is one of the reasons why you should never use it for any production system.
Personally, I would never trust the automated black box structure to handle changes to the datamodel in all but strictly local / dev environments. I always set it up so that in local development environments you can create drop-drops. After you start promoting your application to the central test / step, and then run it, all database changes are made by the database administrator: with good old-fashioned DDL scripts. Data is too valuable for the risk of a potential error or unexpected hibernation (or any other ORM / automated system). I even make sure that the database user configured in my applications does not even have the right to create / delete / modify the database, just to prevent disasters due to poor configuration in sleep mode.
So, to answer your question: if you want hibernate to always support your database reflecting your entities, then create-drop is your only option. Just never use it on anything other than local developer databases.
source share