views:

59

answers:

2

I couldn't find a reference on how to switch hbm2ddl off.

+1  A: 

in hibernate.properties

hibernate.hbm2ddl.auto=validate

Of course, the place to configure it depends on the way you configure your hibernate - if it is programatically, set the property there. If it is from hibernate.cfg.xml:

<property name="hibernate.hbm2ddl.auto">validate</property>
Bozho
That means the hbm2ddl can't switched off?What is the default value of hibernate.hbm2ddl.auto when it is not mentioned in the property file or hibernate.cfg.xml file?
Alex
http://stackoverflow.com/questions/438146/hibernate-question-hbm2ddl-auto-possible-values-and-what-they-do
Don Roby
@Alex - I assumed you have tried, and having problems. See Pascal's answer. "Validate" means that hibernate checks whether the mappings are consistent with the DB at launch time.
Bozho
+1  A: 

Just omitting hibernate.hbm2ddl.auto defaults to Hibernate not doing anything. From the reference documentation:

1.1.4. Hibernate configuration

The hbm2ddl.auto option turns on automatic generation of database schemas directly into the database. This can also be turned off by removing the configuration option, or redirected to a file with the help of the SchemaExport Ant task.

It seems also possible to set hbm2ddl.auto to none (this is undocumented). Not tested though.

Pascal Thivent
+1, I always forget about that part
Bozho
@Bozho: Thanks.
Pascal Thivent