This content has been marked as final.
Show 3 replies
-
1. Re: database problem
sjmenden Aug 19, 2008 3:16 PM (in response to tonyukuk)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. -
2. Re: database problem
sjmenden Aug 19, 2008 3:45 PM (in response to tonyukuk)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. -
3. Re: database problem
tonyukuk Aug 19, 2008 4:27 PM (in response to tonyukuk)it worked. thank you