Mybatis+Proxool+Spring多数据源

jdbc:

<bean id="dataSource"
		class="com.mchange.v2.c3p0.ComboPooledDataSource"
		destroy-method="close">
		<property name="driverClass" value="${jdbc.driverClassName}" />
		<property name="jdbcUrl" value="${logDataBase.url}" />
		<property name="user" value="${logDataBase.user}" />
		<property name="password" value="${logDataBase.passwd}" />
		<property name="maxPoolSize" value="10" />
		<property name="acquireIncrement" value="5" />
		<property name="idleConnectionTestPeriod" value="60" />
		<property name="testConnectionOnCheckin" value="true" />
		<property name="testConnectionOnCheckout" value="true" />
		<property name="preferredTestQuery" value="select 1 from dual" />
	</bean>
	
	<bean id="mysqldataSource"
		class="com.mchange.v2.c3p0.ComboPooledDataSource"
		destroy-method="close">
		<property name="driverClass" value="${mysql.jdbc.driverClassName}" />
		<property name="jdbcUrl" value="${mysqlDataBase.url}" />
		<property name="user" value="${mysqlDataBase.user}" />
		<property name="password" value="${mysqlDataBase.passwd}" />
		<property name="maxPoolSize" value="10" />
		<property name="acquireIncrement" value="5" />
		<property name="idleConnectionTestPeriod" value="60" />
		<property name="testConnectionOnCheckin" value="true" />
		<property name="testConnectionOnCheckout" value="true" />
		<property name="preferredTestQuery" value="select 1 from dual" />
	</bean>

 mybatis配置文件

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
	</bean>
	<bean id="mysqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="mysqldataSource" />
	</bean>
	<bean name="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.chinacache.mapper.oracle" />  //配置mybatis操作的包,即包内操作的是oracle
		<property name="sqlSessionFactory" ref="sqlSessionFactory" />
	</bean>
	<bean name="mapperScannerConfigurer_1" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<property name="basePackage" value="com.chinacache.mapper.util"/>  //配置mybatis操作的包,即包内操作的是mysql		<property name="sqlSessionFactory" ref="mysqlSessionFactory" />
	</bean>

 其它问题

写道
mybatis 查询to_date的问题,在mybatis查询时xml中的sql中如果有day=to_date('#{day}','yyyy-mm-dd')时,时间不须要加引号,可写为:day=to_date(#{day},'yyyy-mm-dd')

 

你可能感兴趣的:(Spring多数据源)