Generating SQL to initialize database

2006-10-27 Thread Aleksei Valikov

Hi folks.

I wonder, what is the usual approach to generate or include in distribution or 
package the SQL that sets up the database (DDL)?


For instance, I use Hyperjaxb to generate source code and Hibernate mappings 
from the database schema. Based on the Hibernate mappings I can generate the DDL 
that defines the database (there's a plugin to do that).


What I completely miss is how this SQL should be packaged or distributed and so 
on. With HBMs everything works very nice - they are just packaged as resources 
in the JAR (together with Hibernate configuration). Currently I simply use the 
automatic schema creation of Hibernate. That is, during the start-up the 
Hibernate automatically exports the database schema into the database. But what 
should I do in cases when the database may only be created manyally by the admin?


I'd be grateful for you input/advises.
Thanks in advance.

Bye.
/lexi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Generating SQL to initialize database

2006-10-27 Thread Fabricio Lemos

If the database may only be created by the admin, you can´t rely on
HMB files. In that case you should have a script that creates the
database and put it on the resources folder.

On 10/27/06, Aleksei Valikov [EMAIL PROTECTED] wrote:

Hi folks.

I wonder, what is the usual approach to generate or include in distribution or
package the SQL that sets up the database (DDL)?

For instance, I use Hyperjaxb to generate source code and Hibernate mappings
from the database schema. Based on the Hibernate mappings I can generate the DDL
that defines the database (there's a plugin to do that).

What I completely miss is how this SQL should be packaged or distributed and so
on. With HBMs everything works very nice - they are just packaged as resources
in the JAR (together with Hibernate configuration). Currently I simply use the
automatic schema creation of Hibernate. That is, during the start-up the
Hibernate automatically exports the database schema into the database. But what
should I do in cases when the database may only be created manyally by the 
admin?

I'd be grateful for you input/advises.
Thanks in advance.

Bye.
/lexi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Generating SQL to initialize database

2006-10-27 Thread Eric Redmond

I use this quite well. I create a seperate pom project that contains all
the information to generate and populate our test and production databases.

http://mojo.codehaus.org/sql-maven-plugin/examples/execute.html

Eric

On 10/27/06, Fabricio Lemos [EMAIL PROTECTED] wrote:


If the database may only be created by the admin, you can´t rely on
HMB files. In that case you should have a script that creates the
database and put it on the resources folder.

On 10/27/06, Aleksei Valikov [EMAIL PROTECTED] wrote:
 Hi folks.

 I wonder, what is the usual approach to generate or include in
distribution or
 package the SQL that sets up the database (DDL)?

 For instance, I use Hyperjaxb to generate source code and Hibernate
mappings
 from the database schema. Based on the Hibernate mappings I can generate
the DDL
 that defines the database (there's a plugin to do that).

 What I completely miss is how this SQL should be packaged or distributed
and so
 on. With HBMs everything works very nice - they are just packaged as
resources
 in the JAR (together with Hibernate configuration). Currently I simply
use the
 automatic schema creation of Hibernate. That is, during the start-up the
 Hibernate automatically exports the database schema into the database.
But what
 should I do in cases when the database may only be created manyally by
the admin?

 I'd be grateful for you input/advises.
 Thanks in advance.

 Bye.
 /lexi

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Eric Redmond
http://codehaus.org/~eredmond