-
MyBatisJava/Spring 2018. 8. 29. 21:25반응형
http://www.mybatis.org/mybatis-3/getting-started.html
Dao에 sql패키지만듬
MyBatis3에 있는 Product에 doc -> Gettig Started -> 스크롤 내리면
Exploring Mapper SQL <xml 부터 mapper.dtd">까지 복사
sql패키지에 file을 만든다. -> videoDao.xml
<mapper> 추가 namespace="현재 패키지의 인터페이스명" -> VideoDao
------------------------------------
< MyBatis 설정 >
그 후 MyBatis 페이지에 있는 configuration을 복사해서
src/main/resource에 mybatis.xml 파일을 만들고 복사한것 붙여넣기
<configuration> 안에 <typeAliases>그 안에 <typeAlias type="VO패키지경로" alias="VideoVO">추가
------------------------------------
마이바티스 설정이 다 끝나고 videoDao.xml에 mapper안에 <insert id="" parameterType="VideoVO"> <delete id=""> id="Dao의 메소드명"으로 이용한다.
Parameter Type, result Type도 맞춰서 지정한다.
반응형'Java > Spring' 카테고리의 다른 글
Secure Coding - 보안 취약점 관리 사이트 (0) 2018.09.07 Secure Coding - 소프트웨어 개발 방법론 (0) 2018.09.06 Spring Problem - class="org.mybatis.spring.SqlSessionTemplate" not found (0) 2018.08.29 Error - configuring application listener of class org.springframework.web.context.ContextLoaderListener (0) 2018.08.29 Transaction / AOP (0) 2018.08.27 댓글