Spring JDBC » 5.2.24.RELEASE
Apache Commons DBCP » 2.9.0
MyBatis » 3.5.13 » 3.5.10으로 버전 다운
MyBatis Spring » 3.0.2 » 2.0.7로 버전 다운
<bean class="org.apache.commons.dbcp2.BasicDataSource" id="data_source">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl" />
<property name="username" value="scott" />
<property name="password" value="tiger" />
</bean>
<bean class="org.mybatis.spring.SqlSessionFactoryBean" id="sqlSessionFactory">
<property name="dataSource" ref="data_source" />
<property name="mapperLocations" value="/WEB-INF/mapper/**/*_mapper.xml"></property>
</bean>
<bean class="org.mybatis.spring.SqlSessionTemplate" id="sqlSessionTemplate">
<constructor-arg name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<?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="reservation_mapper">
<insert id="insert_reservation" parameterType="com.app.dto.reservation.ReservationDto">
insert into t_reservation
values ( #{roomNumber} , #{customerNumber} )
</insert>
<select id="select_reservation_list" resultType="com.app.dto.reservation.ReservationDto">
select room_number roomNumber, customer_number customerNumber
from t_reservation
</select>
<select id="select_reservation_list_by_roomNumber" resultType="com.app.dto.reservation.ReservationDto"
parameterType="com.app.dto.reservation.ReservationDto">
select room_number roomNumber, customer_number customerNumber
from t_reservation
where room_number = #{roomNumber}
</select>
</mapper>