Computer_IT/JAVA 2011.12.07 17:36

1. 최초 확인한곳..
http://code.google.com/p/mybatis/issues/detail?id=21&colspec=ID%20Type%20Component%20Status%20Priority%20Version%20Target%20Summary%20Reporter


2.  DTD 적용 확인,  
 http://mybatis.org/dtd/mybatis-3-mapper.dtd

3. 
3.1.0 SNAPSHOT 다운로드 / http://code.google.com/p/mybatis/wiki/Downloads?tm=2

4. 사용법

public static SqlSessionFactory sqlMapper = MyBatisManager.getInstance();
System.out.println(  sqlMapper.getConfiguration().getDatabaseId() ); 

등으로 DatabaseId 확인...


testMapper.xml

<?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="testMapper">


<!-- DB2 용 -->

<select id="getUserId" resultType="HashMap" databaseId="DB2/AIX64">

SELECT * FROM DB2_TABLE

</select>

<!-- CUBRID 용-->

<select id="getUserId" resultType="HashMap" databaseId="CUBRID">

SELECT * FROM CUBRID_TABLE

</select>


<!-- databaseId가 정의가 안되었을시... -->

<select id="getUserId" resultType="HashMap">

SELECT * FROM ETC_TABLE

</select>
 

</mapper>

 

in Java...

list = session.selectList("testMapper.getUserId");
일상적으로 사용... 

 
 
 

'Computer_IT > JAVA' 카테고리의 다른 글

VisualSVN Post-commit hook  (0) 2013.02.04
마이피플 위젯 전송 자바 샘플  (0) 2012.07.11
myBatis multi db vendor support  (0) 2011.12.07
Cannot create a server using the selected type  (0) 2010.06.23
groovy - db2 jdbc 연결 기본 예제  (0) 2009.10.07
Java jconsole 설정  (0) 2009.08.20
posted by 고급코드 고급코드