users@glassfish.java.net

RE: Automatic sql script execution on ear deployment?

From: Shevland, Joe <joe.shevland_at_capgemini.com>
Date: Thu, 26 Jul 2007 12:01:31 +1000

> Ah, the examples I have been looking at are JBoss Seam
> examples and are based off of Hibernate as the persistence
> provider. Hibernate has a property that if enabled will do
> this for you.
>
> <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
>
> When this property is set I guess it peforms the sql script
> execution. Since I have always been using TopLink it never
> worked. Is it is easy to replace TopLink with Hibernate since
> I would like this feature.

That property just acts like Toplink in terms of creating (and dropping
first, so its really only a dev-env property with the 'create-drop'
value, there's an 'update' one which updates the schema etc) tables
based on the entities you've defined, not running any data-loading
script you might have floating around.

If none of the other suggestions are appropriate (and I thought creating
the data as part of the script to deploy the application was), maybe a
web context listener that checks a field in a control table and runs a
script if the value hasn't been set to true (which'd happen at the end
of the script/s).

Cheers
Joe

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.