ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo <bost...@gmail.com>
Subject Select environment using XML
Date Tue, 27 Apr 2010 17:33:19 GMT
I have this configuration in ibatis-config.xml

<configuration>
    <properties resource="collector.properties"/>
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC" />
            <dataSource type="POOLED">
                <property name="driver" value="${dev.jdbc.driver}" />
                <property name="url" value="${dev.jdbc.url}" />
            </dataSource>
        </environment>
        <environment id="test">
            <transactionManager type="JDBC" />
            <dataSource type="POOLED">
                <property name="driver" value="${test.jdbc.driver}" />
                <property name="url" value="${test.jdbc.url}" />
            </dataSource>
        </environment>
    </environments>
    <mappers>
    </mappers>
</configuration>

As shown it will load datasource from <environment id="development">

QUESTION: Is it possible at run time switch to use <environment id="test">
without modifying XML? For example - I have a test file where I'm using
SqlSessionFactory and want to set it programmatically to use test
environment?

Mime
View raw message