How about make different implementation So
Tenant1 extends tenanta Tenant2 extends tenantb /m/ -----Original Message----- From: Eduard Neuwirt <eduard.neuw...@googlemail.com> Date: Fri, 15 Oct 2010 16:16:35 To: Struts Users Mailing List<user@struts.apache.org> Reply-To: "Struts Users Mailing List" <user@struts.apache.org> Subject: Re: Struts, Spring, Hibernate and multiple Sessionfactories Hi Li, thanks for the answer. I didn't get how does it work within the struts-spring plugins ? In this case ist the the question is how to access to the application context directly from struts session. I could not find any information in the docu. Regards Eduard 2010/10/15 Li Ying <liying.cn.2...@gmail.com> > If you want to use multi-DB for multi-tenant (let's say tenant01 and > tenant02) > > I think you can create config file should likes: > > <bean id="sessionFactory_tenant01" class="xxxxx"> > <property name="configLocation" value="cfg_tenant01.xml"/> > </bean> > > <bean id="sessionFactory_tenant02" class="xxxxx"> > <property name="configLocation" value="cfg_tenant02.xml"/> > </bean> > > and then, in your java code, you can get different bean instance for > different tenant via [ID], > code looks like: > BeanFactory.getBean("sessionFactory_" + tenantID,SessionFactory.class); > > > You can read this document for more information: > > http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/BeanFactory.html#getBean%28java.lang.String,%20java.lang.Class%29 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >