I\'m working with PostgreSQL and Spring 4 and want my app auto create database when it running.
My Entity Class is:
@Entity
@Table(name = \"user\", s
The property hibernate.hbm2ddl.auto will do the trick for you. It automatically validates or exports 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.
Hibernate can accept these options for the above property.
validate: validate the schema, makes no changes to the database.
update: update the schema.
create: creates the schema, destroying previous data.
create-drop: drop the schema at the end of the session.