You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Moritz Gmelin <mo...@gmx.de> on 2008/01/29 16:27:22 UTC

Changing default hibernate.cfg.xml

Hi,

I have multiple services invoved in my web-application that are used  
in other sub-projects  too. That's why it would be useful to be able  
to manually set the file name for the hibernate configuration to be  
used (default is always hibernate.cfg.xml).

I tried to do the following in AppModule


     public void contributeHibernateSessionSource  
(OrderedConfiguration<HibernateConfigurer> conf) {
     	class MHibernateConfigurer implements HibernateConfigurer {

			public void configure(org.hibernate.cfg.Configuration  
configuration) {
     			configuration.configure("hibernate_foo.cfg.xml");				
			}
     	};
     	
		conf.add("Default", new MHibernateConfigurer());
     }

But it tells me that the "Default" Configuration is already there and  
it cannot be changed.
Is there another way I can achieve this?

Regards

Moritz

Re: Changing default hibernate.cfg.xml

Posted by Kalle Korhonen <ka...@gmail.com>.
Maybe you found an answer to this already, but you need to disable the
default configuration first (
http://tapestry.apache.org/tapestry5/tapestry-hibernate/conf.html). But I
agree, it might make more sense that you'd just be able to override the
value for the default filename. At least for me, it's a typical scenario
that you run the app in test mode against hsql but in production mode
against derby/mysql.

Kalle


On Tue, Jan 29, 2008 at 8:27 AM, Moritz Gmelin <mo...@gmx.de> wrote:

> Hi,
>
> I have multiple services invoved in my web-application that are used in
> other sub-projects  too. That's why it would be useful to be able to
> manually set the file name for the hibernate configuration to be used
> (default is always hibernate.cfg.xml).
>
> I tried to do the following in AppModule
>
>
>    public void contributeHibernateSessionSource
> (OrderedConfiguration<HibernateConfigurer> conf) {
>        class MHibernateConfigurer implements HibernateConfigurer {
>
>                        public void
> configure(org.hibernate.cfg.Configuration configuration) {
>                        configuration.configure("hibernate_foo.cfg.xml");
>
>                        }
>        };
>
>                conf.add("Default", new MHibernateConfigurer());
>    }
>
> But it tells me that the "Default" Configuration is already there and it
> cannot be changed.
> Is there another way I can achieve this?
>
> Regards
>
> Moritz

Re: Changing default hibernate.cfg.xml

Posted by mik <fo...@mail.ru>.
Not shure, but I think your method have to be static.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Changing-default-hibernate-cfg-xml-tp2430530p4932409.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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