ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Raupach <raup...@e2n.de>
Subject Re: Select environment using XML
Date Wed, 28 Apr 2010 08:13:37 GMT
This is not run-time. You must redeploy the application. Why not select the environment
based on a property file? This way you only need to restart the application.

<environments default="${env}">

Looks like a nice feature. Is there anything to be said against it?



On Apr 28, 2010, at 3:02 AM, Alex Park wrote:

> Hi,
> 
> SqlSessionFactoryBuilder.build() method can select a specific environment in XML.
> 
> For example,
> 
> private Reader reader;
> private SqlSessionFactory sqlSessionFactorys;
> private SqlSession session;
> 
> reader = Resources.getResourceAsReader("ibatis-config.xml");
> 
> sqlSessionFactorys = new SqlSessionFactoryBuilder().build(reader, "test");
> testSession = sqlSessionFactorys.openSession(); // test env
> 
> sqlSessionFactorys = new SqlSessionFactoryBuilder().build(reader, "dev");
> devSession = sqlSessionFactorys.openSession(); // dev env
> 
> 
> Thanks,
> Alex
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message