views:

50

answers:

2

When I create (using JPA - java persistence api) a persistence unit and then persistence entities they auto create the corresponding tables and fields in the database.

Can I also make it to auto create the database (if it doesn't exist)?

My objectif is :

I mean it creates inside the database the tables and fields, but not the database, and if the database hasn't been created before (by hand) - everything fails. So before running the project (which will auto generate the tables and fields if needed) I first must create (by hand) a database.

I use : Eclispse (Java, Hibernate, Flex/Air), MySQL

Thanks for all information

+3  A: 

The database has to be created manually (Fortunatly you didn't ask why ;-). Which is similar to the user/password combination you use to connect to your database server, which must already exist in order to connect to the DB.

stacker