Using mutiple datasources in myBatis and Spring -
i have application uses spring+mybatis , have mapper interface hold sql queries.
mapper.java
package it.helloworld.mybatis; import it.helloworld.dao.model.numbers; import java.util.list; import org.apache.ibatis.annotations.select; public interface mapper { @select("select * numbers") list<numbers> getnumbers(); }
i have used mapperscannerconfigurer use mapper follows:
<bean class="org.mybatis.spring.mapper.mapperscannerconfigurer"> <property name="basepackage" value="it.helloworld.ibatis" /> <property name="sqlsessionfactorybeanname" value="sqlsessionfactory1" /> </bean>
i have used name 'sqlsessionfactory1' because have mutiple datasources in application.
my question is:
i change interface xml file. meaning want store sql query in xml instead of interface. can configure mapperscannerconfigurer read sql xml instead of interface.? if yes, how.? if not, should use make minimum code changes.?
please check http://mybatis.github.io/spring/factorybean.html more details on configuring sqlsessionfactory1
Comments
Post a Comment