Danylo Volokh
Danylo Volokh

Reputation: 4285

How to make hibernate to drop one table and leave other?

I Have this code in my hibernate.cfg.xml

 <property name="hbm2ddl.auto">create</property>

It means that every time I run the application hibernate will drop all tables and create new ones.

How can I specify that it should only drop some specific table let say "Cars"? Does hibernate has that kind of configure option?

Upvotes: 3

Views: 324

Answers (1)

Andremoniy
Andremoniy

Reputation: 34900

Don't use hbm2ddl.auto - this is a very bad thing in production and can be used only for early-testing purposes.

What have you asked: no, hibernate can't do that using standard features.

I can suggest you look at Liquibase framework for doing any DB updates.

Upvotes: 2

Related Questions