아주 간단 한 ibatis 예
package com.ibatis;
public class Author {
private int id;
private String name;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
STEP 2: author. xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap
PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="Author">
<!-- -->
<!-- -->
<typeAlias alias="author" type="com.ibatis.Author" />
<!--
<cacheModel type="LRU" >
, ,
<flushInterval hours="24"></flushInterval>
statement ,
<flushOnExecute statement="updateAuthor"/>
SIZE: cacheModel
<property value="1000"/>
</cacheModel>
, :<select resultClass="author" cacheModel="authorCache">
cacheModel"authorCache" , statement ,
,
-->
<!--Statement -->
<select resultClass="author">
<![CDATA[SELECT * FROM author]]>
</select>
<update parameterClass="author">
<![CDATA[UPDATE author SET WHERE >
</update>
<delete parameterClass="author">
delete from author WHERE
</delete>
<insert parameterClass="author">
<![CDATA[INSERT INTO author(id,name) VALUES(#id#,#name#)]]>
</insert>
</sqlMap>
세 번 째 단계: SqlMapConfig. properties
driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
url=jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=ibatis
username=sa
password=sa
STEP 4: SqlMapConfig. xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<!-- Ibatis -->
<sqlMapConfig>
<!-- -->
<properties resource="com/ibatis/SqlMapConfig.properties"/>
<!--
cacheModelsEnabled: SqlMapClient 。
enhancementEnabled: POJO geter/seter , 。
lazyLoadingEnabled: 。
maxRequests: 。
maxSessions: Session , SqlMapClient
maxTransactions: 。
-->
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="32"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
<!-- datasource -->
<transactionManager type="JDBC" >
<dataSource type="SIMPLE">
<!--JDBC -->
<property name=JDBC.Driver value="${driver}"/>
<!-- URL-->
<property value="${url}"/>
<!-- -->
<property value="${username}"/>
<!--
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
깊이 중첩된 객체를 정확히 일치 검색 - PostgreSQL목차 * 🚀 * 🎯 * 🏁 * 🙏 JSON 객체 예시 따라서 우리의 현재 목표는 "고용주"사용자가 입력한 검색어(이 경우에는 '요리')를 얻고 이 용어와 정확히 일치하는 모든 사용자 프로필을 찾는 것입니다. 즐거운 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.