You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2010/11/07 09:45:54 UTC

best way to apply database upgrades at startup

Hi,

I'm using tapestry-hibernate and hibernate is configured partly by 
hibernate.cfg.xml and some properties supplied in 
AppModule.contributeHibernateSessionSource.

I need to apply database upgrades before hibernate has a chance to 
validate mapped entities.

Since I have access to the configuration properties for the database and 
hibernate has not yet initialised in 
AppModule.contributeHibernateSessionSource it seems this would be a 
reasonable place to apply my upgrades via straight JDBC.

Does this sound like a good approach or has someone done something 
similar in a smarter way?

regards, paul.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: best way to apply database upgrades at startup

Posted by Onno Scheffers <on...@piraya.nl>.
Have you tried LiquiBase (http://www.liquibase.org/)?
It includes a ServletListener that allows you to update your database before
you webapp fires up.

I've only used it on a single project so far, but I'm pretty happy with it.


regards,

Onno


On Sun, Nov 7, 2010 at 9:45 AM, Paul Stanton <pa...@mapshed.com.au> wrote:

> Hi,
>
> I'm using tapestry-hibernate and hibernate is configured partly by
> hibernate.cfg.xml and some properties supplied in
> AppModule.contributeHibernateSessionSource.
>
> I need to apply database upgrades before hibernate has a chance to validate
> mapped entities.
>
> Since I have access to the configuration properties for the database and
> hibernate has not yet initialised in
> AppModule.contributeHibernateSessionSource it seems this would be a
> reasonable place to apply my upgrades via straight JDBC.
>
> Does this sound like a good approach or has someone done something similar
> in a smarter way?
>
> regards, paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: best way to apply database upgrades at startup

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sun, 07 Nov 2010 06:45:54 -0200, Paul Stanton <pa...@mapshed.com.au>  
wrote:

> Hi,

Hi!

> Does this sound like a good approach or has someone done something  
> similar in a smarter way?

I think it is. The probably most correct and recommended way would be  
contributing a Runnable that executes your logic to the RegistryStartup  
service or using a startup method (T5.2+). Igor's blog has some nice  
examples: http://blog.tapestry5.de/index.php/2010/06/.


-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org