1 Ibatis에서 MyBatis로 변경된 이유

Apache project팀에서 google code팀으로 이동하면서 명칭이 변경됨.

 

2 차이점

2.1 Java 요구 버전

iBatis에서는 JDK 1.4 이상에서 사용 가능 MyBatis에서는 JDK 1.5 이상 사용 가능.

2.2 패키지 내부 구조가 변경되었음.

ibatis : com.ibatis.*

MyBatis : org.apache.ibatis.*

2.3 sqlMap.xml 내부 구조가 변경되었음.

parameterMap 사용 못함. -> parameterType으로 대체.

dtd가 변경 (“http://mybatis.org/dtd/mybatis-3-mapper.dtd”>

사용 용어의 변경

SqlMapConfig
Configration
sqlMap
Mapper
resultClass
resultType

 

2.4 MyBatis lib 별도 제공

Maven Dependency Information 예시

<dependency>

<groupId>org.mybatis</groupId>

<artifactId>mybatis</artifactId>

<version>3.2.2</version>

</dependency>

 

<dependency>

<groupId>org.mybatis</groupId>

<artifactId>mybatis-spring</artifactId>

<version>1.2.0</version>

</dependency>

 

2.5 Annotation 도입

sqlMapClient DI 설정 불필요

간편해짐

Bean id sqlSesstionFactory, sqlSesstionTemplate만 지정하면 됨.

2.6 rowHandler 대체

xml및 대량 데이터 처리를 위해 사용되었던 rowHandler가 삭제

rowHandler -> resulthandler로 변경됨

자바 annotation을 사용하여 xml을 사용하지 않고 자바로만 할 수 있게 됨.

자바 선언 보다 xml 선언이 우선순위를 가짐.

2.7 네임스페이스 방식 변경

ibatis : <sqlMap namespace=”User”>

MyBatis : <mapper namespace=”myBatis.mapper.UserMapper”>

네임스페이스 사용은 필수, userStatementNameSpace설정 제거

2.8 동적 SQL – XML 엘리먼트

If, choose(when, otherwise), trim (whre,set), foreach

2.9 동적 SQL – Provider annotation

@SelectProvider(type=CommentSqlProvider.class, method=”selectCommentByCondition”)

2.10 캐시 지원.

2.11 (스프링 연동모듈) mapper 자동 검색

 

3 변경되거나 추가된 속성들 (종합)

iBatis
MyBatis
비고
com.ibatis.*
org.apache.ibatis.*
패키지 구조 변경
SqlMapConfig
Configration
용어변경
sqlMap
mapper
용어변경
sqlMapClient
sqlSession
구문대체
rowHandler
resultHandler
구문대체
resultHandler
SqlSessionFactory
구문대체
parameterMap, parameterClass
parameterType
속성 통합
resultClass
resultType
용어변경
#var#
#{var}
구문대체
$var$
${var}
구문대체
<isEqual> , <isNull>
<if>
구문대체

+ Recent posts