ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Park <yjac...@paran.com>
Subject Re: Select environment using XML
Date Wed, 28 Apr 2010 01:01:32 GMT
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


Mime
View raw message