+3  A: 

Hibernate has a property called schemaUpdate. Set it on your SessionFactory so that the database is created on initialization.

<property name="schemaUpdate" value="true" />

If you are using JPA, then there is a generateDdl property that is to be set on the JpaVendorAdapter

Bozho
thanks. I might be wrong but from what I know schema update uses the ORMs to init the database. Is there a way to do it via an SQL script?
Li
well, the ORM generates the SQL script and executes it, based on your mappings. It is the ideal way of doing it. I, for example, haven't had any problems with this, and didn't need any customizations or custom scripts.
Bozho
I have to use a specific script to create the schema so I cannot use the schemaUpdate option. A solution that was suggested to me is to extend the DataSource implementation and init the db there.
Li
hm, why do you have to use a specific script?
Bozho
I had a few things that I didn't want hibernate to do, so I wanted a specific script.What I finally used (when I was able not to use the script) is -<prop key="hibernate.hbm2ddl.auto">create</prop>thanks for the help
Li