RSS구독하기:SUBSCRIBE TO RSS FEED
즐겨찾기추가:ADD FAVORITE
글쓰기:POST
관리자:ADMINISTRATOR
Languages/JAVA  2010/02/07 23:31

1.iBATIS 의 설정을 도와주는 ibator(구 abator) 설치

http://ibatis.apache.org/ibator.html

Eclipse Plugin

Take the "Help>Software Updates..." Menu Option

  1. Select the "Available Software" Tab
  2. Press the "Add Site" button
  3. Enter the following information:
    Location: http://ibatis.apache.org/tools/ibator
  4. Press OK
  5. Check the box next to "Apache iBATIS Ibator Feature"
  6. Press the "Install" button
  7. Follow the remainder of the install wizard

   

ibator 플러그인 설치

   

   

설정파일을 만들어보자

New > Other > Apache iBATIS Ibator > Apache iBATIS Ibator Configuration file 을 선택한다.

   

설정파일의 저장경로와 파일명 설정

   

생성된 ibatorConfig.xml 파일내용

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >

<ibatorConfiguration >

<ibatorContext id="context1" >

<jdbcConnection driverClass="???" connectionURL="???" userId="???" password="???" />

<javaModelGenerator targetPackage="???" targetProject="???" />

<sqlMapGenerator targetPackage="???" targetProject="???" />

<daoGenerator targetPackage="???" targetProject="???" type="GENERIC-CI" />

<table schema="???" tableName="???" >

<columnOverride column="???" property="???" />

</table>

</ibatorContext>

</ibatorConfiguration>

   

변경된 내용

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >

<ibatorConfiguration >

<classPathEntry location="C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar"/>

<ibatorContext id="context1" >

<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@127.0.0.1:1521:XE" userId="javauser" password="dkdlxl" />

<javaModelGenerator targetPackage="net.bit.lecture.board.vo" targetProject="JDK_015_IBATOR/src" />

<sqlMapGenerator targetPackage="net.bit.lecture.board.dao" targetProject="JDK_015_IBATOR/src" />

<daoGenerator targetPackage="net.bit.lecture.board.dao" targetProject="JDK_015_IBATOR/src" type="GENERIC-CI" />

<table schema="JAVAUSER" tableName="TB_BOARD" domainObjectName="Board" >

</table>

</ibatorContext>

</ibatorConfiguration>

   

<classPathEntry> : ojdbc jar 파일의 물리경로이다.

<jdbcConnection> : 데이타베이스 드라이버 및 계정정보 설정

<javaModelGenerator> : src 폴더 내부에 모델 클래스를 가지는 bean을 생성한다. 'targetPackage'에 bean이

생성될 패키지명을 기입하고, targetProject에는 프로젝트 명을 기입한다

<sqlMapGenerator> : 생성될 매핑 파일의 저장 경로설정

<daoGenerator> : iBATIS를 사용하는 DAO 클래스 bean을 생성한다

<table> : 데이타베이스 스키마, 테이블정보 설정

schema="DB계정" tableName="테이블명" domainObjectName="여기에 등록된이름으로 모델bean이 생성된다"

   

만약 다른 테이블에 대한 iBATIS설정이 필요하다면 <ibatorContext id="context1" >의 id를 다르게하여 추가해 주면된다.

   

config파일 설정 후 config.xml파일을 우클릭하면 아래와 같이 Generate iBATIS Artifacts 를 선택할 수 있다.

   

Generate iBATIS Artifacts를 클릭하면 domainObjectName으로 등록된 이름으로 DAO Interfase 파일과 DAO Interface를 상속한 DAO 클랙스, DB계정+테이블명+sqlMap.xml이름으로된 매핑파일, 모델bean(VO) 파일등이 자동 생성된다.

   

이올린에 북마크하기
2010/02/07 23:31 2010/02/07 23:31
http://jiny.kr/trackback/438
전체 (406)
지니소식 (4)
자료실 (4)
정보|뉴스 (5)
SmartPhone (1)
Languages (206)
Server (153)
Database (27)
Design (4)
Gallery (0)
분류하기귀찬.. (2)
«   2010/09   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
  1. Prozac.  06/24
    Zoloft or prozac which is better.
  2. Online alprazolam.  02/14
    Xanax alprazolam overnight.
  3. 창의력과 상상력을 넘어서  2009
    Tomcat 6.0 기본 환경 설정
  4. 닥공  2009
    서블릿 tomcat 6.0 실행시 에러
  1. 2010/07 (1)
  2. 2010/05 (1)
  3. 2010/02 (3)
  4. 2010/01 (3)
  5. 2009/05 (2)
Statistics Graph