This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bean id="masterAdminDao" class="org.mybatis.spring.SqlSessionTemplate"> | |
<constructor-arg index="0" ref="sqlSessionMasterFactory" /> | |
</bean> | |
<!-- | |
<bean id="slaveAdminDao" class="org.mybatis.spring.SqlSessionTemplate"> | |
<constructor-arg index="0" ref="sqlSessionSlaveFactory" /> | |
</bean> | |
--> | |
<bean id="slaveDao" class="org.mybatis.spring.SqlSessionTemplate"> | |
<constructor-arg index="0" ref="sqlSessionSlaveFactory" /> | |
</bean> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Master DB--> | |
<bean id="master" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> | |
<property name="driverClassName" value="com.mysql.jdbc.Driver" /> | |
<property name="url" value="jdbc:mysql://${my.master.admin}:3306/database_name?useUnicode=true&characterEncoding=utf8&autoReconnect=true" /> | |
<property name="username" value="${mysql.id}" /> | |
<property name="password" value="${mysql.pwd}" /> | |
<!-- Pool Setting --> | |
<property name="maxActive" value="5" /> | |
<property name="maxIdle" value="5" /> | |
<property name="maxWait" value="10000" /> | |
<property name="poolPreparedStatements" value="true"/> | |
<!-- Delete when it will release to real searvice --> | |
<property name="validationQuery" value="select 1"/> | |
<property name="testWhileIdle" value="true"/> | |
<property name="timeBetweenEvictionRunsMillis" value="7200000"/> | |
</bean> | |
<!-- Slave DB 00 --> | |
<bean id="slave00" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> | |
<property name="driverClassName" value="com.mysql.jdbc.Driver" /> | |
<property name="url" value="jdbc:mysql://${my.slave.admin.00}:3306/dual_hadoop?useUnicode=true&characterEncoding=utf8&autoReconnect=true" /> | |
<property name="username" value="${mysql.id}" /> | |
<property name="password" value="${mysql.pwd}" /> | |
<property name="maxActive" value="5" /> | |
<property name="maxIdle" value="5" /> | |
<property name="maxWait" value="10000" /> | |
<property name="validationQuery" value="select 1"/> | |
<property name="testWhileIdle" value="true"/> | |
<property name="timeBetweenEvictionRunsMillis" value="7200000"/> | |
</bean> | |
<!-- Master--> | |
<bean id="sqlSessionMasterFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> | |
<property name="dataSource" ref="master" /> | |
<property name="configLocation" value="classpath:masterAdminMap.xml"/> | |
<!-- <property name="mapperLocations" value="classpath:sqlMap/masterAdminSql.xml" /> --> | |
</bean> | |
<!-- Slave--> | |
<bean id="sqlSessionSlaveFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> | |
<property name="dataSource" ref="sg2Slave00" /> | |
<property name="configLocation" value="classpath:slaveAdminMap.xml"/> | |
<!-- <property name="mapperLocations" value="classpath:sqlMap/slaveAdminSql.xml" /> --> | |
</bean> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" | |
"HTTP://mybatis.org/dtd/mybatis-3-config.dtd"> | |
<configuration> | |
<!-- These settings control SqlMapClient configuration details, primarily to do with transaction | |
management. They are all optional (more detail later in this document). --> | |
<settings> | |
<setting name="defaultStatementTimeout" value="5000" /> | |
</settings> | |
<mappers> | |
<mapper resource="sqlMap/slaveSql.xml" /> | |
<!-- <mapper resource="sqlMap/slaveAdminSql.xml" /> --> | |
</mappers> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface SlaveDao { | |
public HadoopGameModel selectGame(Map<String, Object> map) throws SQLException; | |
public List<HadoopGameModel> selectGameList(Map<String, Object> map) throws SQLException; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
<mapper namespace="jp.hadoop.admin.dao.SlaveDao"> | |
<select id="selectGame" parameterType="map" | |
resultType="jp.hadoop.admin.bean.model.HadoopGameModel"> | |
SELECT | |
game_id AS gameId, | |
game_domain AS gameDomain, | |
game_title AS gameTitle, | |
game_explain AS gameExplain, | |
game_file AS gameFile, | |
game_status_flag AS gameStatusFlag, | |
insert_time AS insertTime, | |
update_time AS updateTime | |
FROM | |
dual_game | |
WHERE | |
game_id = #{gameId} | |
</select> | |
<select id="selectGameList" parameterType="map" | |
resultType="jp.hadoop.admin.bean.model.HadoopGameModel"> | |
SELECT | |
game_id AS gameId, | |
game_domain AS gameDomain, | |
game_title AS gameTitle, | |
game_explain AS gameExplain, | |
game_file AS gameFile, | |
game_status_flag AS gameStatusFlag, | |
insert_time AS insertTime, | |
update_time AS updateTime | |
FROM | |
dual_game | |
</select> | |
</mapper> |
No comments:
Post a Comment