I’m new to hibernate. While writing hibernate code, I found that there are following two ways to generate the schema:
- Using
new SchemaExport(config).create(true, true)method - Using the XML configuration option hbm2ddl.auto
Can someone please explain what is difference between these two options and which one to use?
I’m using hibernate-distribution-3.3.2.G.A
The first one allows creating the schema when you want to, by executing this code.
The second one configures Hibernate to do it each time the session factory is created.