ORM(Object-Relation Mapping/객체-관계 매핑)
참고자료
JDBC는 DB에 접근할 수 있도록 자바에서 제공하는 API
<!-- Mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.1</version>
</dependency>
<!-- Mybatis Spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.4</version>
</dependency>
<?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="psdDAO">
<insert id="insertBoard">
<![CDATA[
insert into table_psd (idx, name, fname)
values (table_sq.NEXTVAL, #{name} , #{fname})
]]>
</insert>
<delete id="deleteBoard">
<![CDATA[
delete from table_psd where idx = #{idx}
]]>
</delete>
<select id="selectAll">
SELECT *
FROM TABLE_PSD
ORDER BY IDX DESC
</select>
<select id="delete_name">
SELECT FNAME
FROM TABLE_PSD
WHERE IDX = #{idx}
</select>
<update id="updateBoard">
UPDATE TABLE_PSD
SET NAME = #{name}
WHERE IDX = #{idx}
</update>
</mapper>