This content has been marked as final. Show 3 replies
Per Hibernate docs:
hibernate.hbm2ddl.auto Automatically validate or export 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.
eg. validate | update | create | create-drop
so in your persistence.xml you want to comment out:
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
or set it to create to generate your ddl for the first time then comment it out. Of course, in production you never want a create-drop policy, but during development it is the best idea to allow quick changes to your Entities/code.
One addition to what I was previously saying, in development, you'll typically combine <property name="hibernate.hbm2ddl.auto" value="create-drop"/> with import statements in your import-dev.sql which will create-drop your ddl every time you redeploy and repopulate the database with test data for you to click through and manually test out new code.
it worked. thank you