DB 접속을 위한 정보가 들어있는 파일입니다
MET-INF/context.xml을 자동으로 찾아 읽어와서 DB 커넥션 연결 객체를 반환하는 클래스
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="board">
<!-- insert 문
#{property} vo.BoardVO getter
#{subject} => vo.getSubject();
-->
<insert id="save" parameterType="ex2.BoardVO">
INSERT INTO BOARD VALUES(board_seq.nextVal,#{title},#{writer},#{content},#{pwd},0,#{reip},sysdate)
</insert>
<select id="list" resultType="ex2.BoardVO">
SELECT no,title,writer,content,hit,regdate FROM BOARD ORDER BY 1 DESC
</select>
<update id="hit" parameterType="int">
update board set hit=hit+1 where no=#{no}
</update>
<select id="detail" parameterType="int" resultType="ex2.BoardVO">
SELECT no,title,writer,hit,content,reip,regdate FROM BOARD WHERE no=#{no}
</select>
<select id="checkpass" parameterType="ex2.BoardVO" resultType="int">
select count(*) as cnt from board where no=#{no} AND pwd=#{pwd}
</select>
<select id="getUpdateDelete" parameterType="int" resultType="ex2.BoardVO">
SELECT no,title,writer,hit,content,pwd,reip,regdate FROM BOARD WHERE no=#{no}
</select>
<update id="updateBoard" parameterType="ex2.BoardVO">
update board set title=#{title}, writer=#{writer}, content=#{content}, pwd=#{pwd}, reip=#{reip}, regdate=sysdate where no=#{no}
</update>
<delete id="RemoveBoard" parameterType="int">
delete from board where no=#{no}
</delete>
</mapper>
boardMap.xml
쿼리코드 축약
DB에서 데이터를 가져오는 메서드들