You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Graham Ford <gr...@gmail.com> on 2009/01/26 21:39:52 UTC

Tapestry Hibernate configuration

Hi,

Is there a way of setting the hibernate configuration file for the 
HibernateModule? For example in my src/main/resources I want the config 
to point to a live database, but for testing a different database. Is 
there a way of doing this, without having to configure hibernate myself 
and then adding it to the HibernateModule?

Thanks,
Graham

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


Re: Tapestry Hibernate configuration

Posted by Daniel Jue <te...@gmail.com>.
Aside from a purely T5 way of doing it,

*You can also look up a JNDI source, configured in your web.xml and in a
context.xml, and then have a different context.xml on each server you deploy
to.  (This is assuming you can use the same dialect and options.)  I used to
switch back and forth between JavaDB (Derby) and Oracle, but the Oracle
stuff got so hairy I ended up just installing Oracle on a VM so the app
would behave.
You can specify the JNDI source in your hibernate.cfg.xml, etc.  A
server-specific context.xml can live on each app server.  If eclipse tries
to erase your context file, try defining it somewhere else, like a
server.xml or context.xml.default.  (at least in Tomcat)

*I bet you could do all sorts of maven/ant kung-fu packaging different
hibernate configs for different profiles.

*You can use a context.xml type file to store variables that your App
modules can load, for doing such useful things like turning on HTTPS only,
production mode, etc.  Then that over-the-phone-sys-admin can just poke
around the context.xml, instead of in your WAR directory, when the
servername needs to be switched, or a password changes.

Daniel

On Mon, Jan 26, 2009 at 5:38 PM, Howard Lewis Ship <hl...@gmail.com> wrote:

> You can contribute to the HibernateSessionSource service. Your
> contributions are objects that are used to configure the Hibernate.
> Such objects can decide what mode ("production" vs. "development") you
> are in, and set the correct values for various Hibernate Configuration
> properties.
>
> On Mon, Jan 26, 2009 at 12:39 PM, Graham Ford <gr...@gmail.com>
> wrote:
> > Hi,
> >
> > Is there a way of setting the hibernate configuration file for the
> > HibernateModule? For example in my src/main/resources I want the config
> to
> > point to a live database, but for testing a different database. Is there
> a
> > way of doing this, without having to configure hibernate myself and then
> > adding it to the HibernateModule?
> >
> > Thanks,
> > Graham
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Tapestry Hibernate configuration

Posted by Howard Lewis Ship <hl...@gmail.com>.
You can contribute to the HibernateSessionSource service. Your
contributions are objects that are used to configure the Hibernate.
Such objects can decide what mode ("production" vs. "development") you
are in, and set the correct values for various Hibernate Configuration
properties.

On Mon, Jan 26, 2009 at 12:39 PM, Graham Ford <gr...@gmail.com> wrote:
> Hi,
>
> Is there a way of setting the hibernate configuration file for the
> HibernateModule? For example in my src/main/resources I want the config to
> point to a live database, but for testing a different database. Is there a
> way of doing this, without having to configure hibernate myself and then
> adding it to the HibernateModule?
>
> Thanks,
> Graham
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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