Spring Boot

{Spring Boot} - MyBatis사용법

중엔 2022. 6. 20. 16:47

1. SqlSessionTemplate 방식 (Mybatis 3.0 이전)

Mybatis - String Substitution

가장 대중화되어있는 방식

xml 파일에 작성된 쿼리을 통해 실행시킨다

Controller

Service

DAO

Mapper

Xml

2. Mapper Interface 방식 (Mybatis 3.0 이후)

Mybatis - String Substitution

3이상 버전부터 mapper.xml 대신 interface 클래스의 Annotation을 통해 SQL을 사용할 수 있다.

controller

service

mapper

 

 

참조 : https://mybatis.org/mybatis-3/ko/index.html