锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品一区二区久久hs,亚洲精品福利视频,亚洲精品天天影视综合网http://www.tkk7.com/zyl/category/19104.html濂藉ソ瀛︿範錛屽ぉ澶╁悜涓?/description>zh-cnTue, 27 Feb 2007 19:46:53 GMTTue, 27 Feb 2007 19:46:53 GMT60鎰熷彈jpahttp://www.tkk7.com/zyl/archive/2007/01/23/95606.html甯冭。閮?/dc:creator>甯冭。閮?/author>Tue, 23 Jan 2007 13:20:00 GMThttp://www.tkk7.com/zyl/archive/2007/01/23/95606.htmlhttp://www.tkk7.com/zyl/comments/95606.htmlhttp://www.tkk7.com/zyl/archive/2007/01/23/95606.html#Feedback2http://www.tkk7.com/zyl/comments/commentRss/95606.htmlhttp://www.tkk7.com/zyl/services/trackbacks/95606.html
鍏剁洰鏍囧氨鏄疄鐜癹ava 鎸佷箙鎬х殑閫氱敤銆俲pa閲囩敤綰痯ojo鐨勬柟寮忓疄鐜幫紝鏇村鐨勬槸閲囩敤java 5娉ㄩ噴銆俲pa 鐨勪紭鍔挎槸澶氫緵搴斿晢鐨勬敮鎸侊紝鍙互榪愯鍦ㄥ鍣?br />
涔嬩腑錛屼篃鍙互榪愯浜庡鍣ㄤ箣澶栵紝榪欏氨鏄叾浼樼偣銆?br />
聽聽聽 hibernate 浠?.2寮濮嬶紝灝卞紑濮嬪吋瀹筳pa銆傚悓鏍鳳紝jdo錛屼篃寮濮嬪吋瀹筳pa銆傚湪orm鐨勯鍩熶腑錛岀湅鏉pa宸茬粡鏄帇閬擄紝瑙勮寖灝辨槸瑙勮寖銆傚湪鍚勫ぇ鍘傚晢

鐨勬敮鎸佷笅錛宩pa鐨勪嬌鐢ㄥ紑濮嬪彉寰楀箍娉涖?br />
聽聽聽 鍦╯pring 2.0.1涓紝姝e紡鎻愪緵瀵筳pa鐨勬敮鎸侊紝鐩墠鏀寔鐨勫疄鐜板寘鎷瑃oplink,hibernate entitymanager浠ュ強openjpa銆傝繖涔熶績鎴愪簡jpa鐨勫彂

灞曪紝瑕佺煡閬搄pa鐨勫ソ澶勫湪浜庡彲浠ュ垎紱諱簬瀹瑰櫒榪愯錛屽彉寰楁洿鍔犵殑綆媧併?br />
聽聽聽 瀵逛簬ejb鏉ヨ錛屽疄浣揵ean涓鐩存槸琚壒璇勭殑瀵硅薄錛岀敱浜庡叾澶鏉傚拰搴炲ぇ銆俲pa鐨勫嚭鐜幫紝寰堝ぇ紼嬪害鐨勫垎紱諱簡澶嶆潅鎬с傝繖璁〆jb鐨勬帹騫夸篃鍙樺緱瀹規槗銆?br />
聽聽聽 浣嗘効涓嶄箙鐨勫皢鏉ワ紝jpa鑳芥垚涓虹湡姝g殑鏍囧噯銆?img src ="http://www.tkk7.com/zyl/aggbug/95606.html" width = "1" height = "1" />

]]>
ibatis 瀵硅薄鍏崇郴瀹炵幇http://www.tkk7.com/zyl/archive/2007/01/16/94229.html甯冭。閮?/dc:creator>甯冭。閮?/author>Tue, 16 Jan 2007 08:22:00 GMThttp://www.tkk7.com/zyl/archive/2007/01/16/94229.htmlhttp://www.tkk7.com/zyl/comments/94229.htmlhttp://www.tkk7.com/zyl/archive/2007/01/16/94229.html#Feedback2http://www.tkk7.com/zyl/comments/commentRss/94229.htmlhttp://www.tkk7.com/zyl/services/trackbacks/94229.html聽聽聽 鑰宨batis榪欐柟闈㈠氨姣旇緝閫婅壊浜嗭紝涓嶈繃瀵逛簬涔熸敮鎸佺畝鍗曠殑鍏寵繛鏌ヨ錛屽1瀵?錛屽拰1瀵瑰銆傚浜庝竴鑸殑鎯呭喌鏉ヨ錛岃繖涓ょ宸茬粡瓚沖浜嗭紝褰撶劧涓嶈兘灞傚彔鏇存柊鏄竴涓己闄鳳紝鐪嬩簡鍗婂ぉ鏂囨。錛屼篃娌℃湁鎵懼埌瀵硅薄涔嬮棿鐨勫眰鍙犳洿鏂幫紝浼拌鏄笉鏀寔銆?br />聽聽聽 浠ュ墠鐨勭増鏈琲batis澶勭悊鍏寵繛鏄氳繃鎵ц涓ゆsql鏉ュ疄鐜扮殑錛屽涓嬬殑瀹炰緥錛?br />聽聽聽 涓瀵瑰鍏寵仈錛?br />聽

<sqlMap namespace="User">
<typeAlias alias="user" type="com.ibatis.sample.User"/>
<typeAlias alias="address" type="com.ibatis.sample.Address"/>
<resultMap id="get-user-result" class="user">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="sex" column="sex"/>
<result property="addresses" column="id" select="User.getAddressByUserId"/>
</resultMap>
<select id="getUsers" parameterClass="java.lang.String" resultMap="get-user-result">
<![CDATA[
select id,name,sex
from t_user
where id = #id#
]]>
</select>
<select id="getAddressByUserId" parameterClass="int" resultClass="address">
<![CDATA[
select address,zipcode
from t_address
where user_id = #userid#
]]>
</select>
</sqlMap>聽聽 聽


榪欓噷閫氳繃鍦╮esultMap 涓畾涔夊祵濂楁煡璇etAddressByUserId錛屾垜浠疄鐜頒簡鍏寵仈鏁版嵁鐨勮鍙栥?br />闇瑕佹敞鎰忕殑鏄紝榪欓噷鏈変竴涓綔鍦ㄧ殑鎬ц兘闂錛屼篃灝辨槸鎵璋撯渘+1鈥漇elect闂銆?br />涓瀵逛竴鍏寵仈錛?br />瀵逛簬榪欑鎯呭喌錛屾垜浠彲浠ラ噰鐢ㄤ竴嬈elect涓ゅ紶琛ㄧ殑鏂瑰紡錛岄伩鍏嶈繖鏍風殑鎬ц兘寮閿錛堝亣璁句笂闈㈢ず渚嬩腑錛屾瘡涓猆ser 鍙湁涓涓搴旂殑Address璁板綍錛夛細


<resultMap id="get-user-result" class="user">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="sex" column="sex"/>
<result property="address" column="t_address.address"/>
<result property="zipCode" column="t_address.zipcode"/>
</resultMap>
<select id="getUsers" parameterClass="java.lang.String" resultMap="get-user-result">
<![CDATA[
select *
from t_user,t_address
where t_user.id=t_address.user_id
]]>
</select>
聽聽聽 聽


鍦ㄧ幇鍦ㄧ殑鐗堟湰涓紝瀵逛簬n+1闂錛宨batis宸茬粡寰堝ソ鐨勮В鍐充簡銆傚涓嬬殑閰嶇疆錛?br />涓瀵逛竴

<resultMap id=鈥漡et-product-result鈥?class=鈥漜om.ibatis.example.Product鈥?gt;
<result property=鈥漣d鈥?column=鈥漃RD_ID鈥?>
<result property=鈥漝escription鈥?column=鈥漃RD_DESCRIPTION鈥?>
<result property=鈥漜ategory鈥?resultMap=鈥済et-category-result鈥?/>
</resultMap>
<resultMap id=鈥漡et-category-result鈥?class=鈥漜om.ibatis.example.Category鈥?gt;
<result property=鈥漣d鈥?column=鈥滳AT_ID鈥?/>
<result property=鈥漝escription鈥?column=鈥滳AT_DESCRIPTION鈥?/>
</resultMap>
<select id=鈥漡etProduct鈥?parameterClass=鈥漣nt鈥?resultMap=鈥漡et-product-result鈥?gt;
select *
from PRODUCT, CATEGORY
where PRD_CAT_ID=CAT_ID
and PRD_ID = #value#
</select>聽聽 聽

鍙互浣跨敤鍐呭湪鐨剅esultMap鏉ヨВ鍐蟲闂銆?br />鍚屾牱涓瀵瑰濡備笅錛?


<sqlMap namespace="ProductCategory">
<resultMap id=鈥漜ategoryResult鈥?class=鈥漜om.ibatis.example.Category鈥?groupBy=鈥漣d鈥?gt;
<result property=鈥漣d鈥?column=鈥滳AT_ID鈥?>
<result property=鈥漝escription鈥?column=鈥滳AT_DESCRIPTION鈥?>
<result property=鈥漰roductList鈥?resultMap=鈥漃roductCategory.productResult鈥?>
</resultMap>
<resultMap id=鈥漰roductResult鈥?class=鈥漜om.ibatis.example.Product鈥?gt;
<result property=鈥漣d鈥?column=鈥漃RD_ID鈥?>
<result property=鈥漝escription鈥?column=鈥漃RD_DESCRIPTION鈥?>
</resultMap>
<select id=鈥漡etCategory鈥?parameterClass=鈥漣nt鈥?resultMap=鈥漜ategoryResult鈥?gt;
select C.CAT_ID, C.CAT_DESCRIPTION, P.PRD_ID, P.PRD_DESCRIPTION
from CATEGORY C
left outer join PRODUCT P
on C.CAT_ID = P.PRD_CAT_ID
where CAT_ID = #value#
</select>
</sqlMap>聽聽 聽


娉ㄦ剰錛岄渶瑕佷嬌鐢ㄥ鍔爂roupBy灞炴ф潵鍒嗙被



]]>
ibatis濡備綍鏀寔clob 鍜宐lobhttp://www.tkk7.com/zyl/archive/2007/01/13/93667.html甯冭。閮?/dc:creator>甯冭。閮?/author>Sat, 13 Jan 2007 13:53:00 GMThttp://www.tkk7.com/zyl/archive/2007/01/13/93667.htmlhttp://www.tkk7.com/zyl/comments/93667.htmlhttp://www.tkk7.com/zyl/archive/2007/01/13/93667.html#Feedback0http://www.tkk7.com/zyl/comments/commentRss/93667.htmlhttp://www.tkk7.com/zyl/services/trackbacks/93667.html聽聽聽 涓嶈繃鍦╯pring 涓凡緇忔彁渚涗簡寰堝ソ鐨勫疄鐜幫紝鎵浠ヨ繖鍙堢渷鍘諱簡寰堝鐨勫姛澶紝鎺ヤ笅鏉ョ湅鐪媔batis鏄浣曟敮鎸乧lob鍜宐lob鐨勩?br />
聽聽聽 ibatis鎻愪緵浜員ypeHandler鎺ュ彛錛岀敤浜庡鐞嗘暟鎹被鍨嬶紝鍩烘湰鐨勫疄鐜扮被涓築aseTypeHandler
聽聽聽 鍦╯pring 涓紝鎻愪緵浜咥bstractLobTypeHandler浣滀負鍩虹綾伙紝騫朵笖鎻愪緵浜嗙浉搴旂殑妯$増鏂規硶錛屾墍鏈夌殑宸ヤ綔鐢盠obHandler澶勭悊銆?br />聽聽聽 BlobByteArrayTypeHandler 涓昏鐢ㄤ簬澶勭悊blob綾誨瀷鏁版嵁錛屼嬌鐢╞yte[]鏉ユ槧灝勭浉搴旂殑blob
聽聽聽 ClobStringTypeHandler 鐢ㄤ簬澶勭悊clob綾誨瀷鏁版嵁錛屼嬌鐢ㄥ瓧絎︿覆鏉ユ槧灝凜lob
聽聽聽 鏈変竴鐐歸渶瑕佹敞鎰忕殑鏄紝AbstractLobTypeHandler涓疄鐜頒簡浜嬪姟鏀寔錛岄渶瑕佺敤鏉ラ噴鏀劇浉搴旂殑璧勬簮錛屾墍浠ヤ竴瀹氶渶瑕佸湪浜嬪姟鐜涓繘琛屻?br />
涓嬮潰鏄竴涓畝鍗曠殑渚嬪瓙錛?br />
public class Food {
聽聽聽 private String content;

聽聽聽 private String id;

聽聽聽 private byte[] image;

聽聽聽 private String name;聽聽 聽
聽聽聽聽聽聽聽 ...
}

xml濡備笅錛氳鏄庝竴涓嬶紝鍦╮esultMap涓彲浠ラ氳繃typeHandler鏉ユ寚瀹氬叿浣撶殑handler.鍦╥nline鍙橀噺涓紝鍙互閫氳繃handler鏉ュ畾涔夌浉搴旂殑typeHandler

<sqlMap namespace="Food">
聽聽 聽
聽聽 聽<typeAlias alias="Food" type="org.esoft.hdb.bo.Food"/>
聽聽 聽<resultMap id="foodResult" class="Food">
聽聽 聽聽聽 聽<result property="id" column="C_ID"/>
聽聽 聽聽聽 聽<result property="name" column="C_NAME"/>
聽聽 聽聽聽 聽<result property="content" column="C_content"
聽聽 聽聽聽 聽聽聽 聽typeHandler="org.springframework.orm.ibatis.support.ClobStringTypeHandler"/>
聽聽 聽聽聽 聽<result property="image" column="C_image"
聽聽 聽聽聽 聽聽聽 聽typeHandler="org.springframework.orm.ibatis.support.BlobByteArrayTypeHandler"/>
聽聽 聽</resultMap>
聽聽 聽<sql id="foodFragment">select C_ID,C_NAME,C_CONTENT,C_IMAGE from T_FOOD</sql>
聽聽 聽聽聽 聽<select id="getAll" resultMap="foodResult">
聽聽 聽聽聽 聽<include refid="foodFragment"/>
聽聽 聽</select>
聽聽 聽<select id="selectById" parameterClass="string" resultMap="foodResult">
聽聽 聽聽聽 聽<include refid="foodFragment"/> where C_ID=#id#</select>
聽聽 聽
聽聽 聽<insert id="insert" parameterClass="Food"> insert into T_FOOD ( C_ID,
聽聽 聽聽聽 聽C_NAME,C_CONTENT, C_IMAGE) values ( #id#,
聽聽 聽聽聽 聽#name#,#content,handler=org.springframework.orm.ibatis.support.ClobStringTypeHandler#,
聽聽 聽聽聽 聽#image,handler=org.springframework.orm.ibatis.support.BlobByteArrayTypeHandler#)
聽聽 聽聽聽 聽</insert>
聽聽 聽
聽聽 聽<update id="update" parameterClass="Food"> update T_FOOD set C_NAME = #name#,
聽聽 聽聽聽 聽C_CONTENT =
聽聽 聽聽聽 聽#content,handler=org.springframework.orm.ibatis.support.ClobStringTypeHandler#,
聽聽 聽聽聽 聽C_IMAGE =
聽聽 聽聽聽 聽#image,handler=org.springframework.orm.ibatis.support.BlobByteArrayTypeHandler#
聽聽 聽聽聽 聽where C_ID = #id# </update>
聽聽 聽
聽聽 聽<delete id="deleteById" parameterClass="string"> delete from T_FOOD where C_ID = #id#
聽聽 聽聽聽 聽</delete>
聽聽 聽
</sqlMap>


public interface FoodService {

聽聽 聽
聽聽聽 void save(Food food);
聽聽聽 Food get(String id);
聽聽聽 /**
聽聽聽聽 * @param food
聽聽聽聽 */
聽聽聽 void update(Food food);
}

public class FoodServiceImpl implements FoodService {
聽聽聽聽 private FoodDAO foodDAO;

聽聽聽 private DaoCreator creator;

聽聽聽 public void setCreator(DaoCreator creator) {
聽聽聽聽聽聽聽 this.creator = creator;
聽聽聽 }

聽聽聽 protected FoodDAO getFoodDAO() {
聽聽聽聽聽聽聽 if (foodDAO == null) {
聽聽聽聽聽聽聽聽聽聽聽 foodDAO = (FoodDAO) creator.createDao(FoodDAO.class, Food.class);
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 return foodDAO;
聽聽聽 }

聽聽聽 public Food get(String id) {
聽聽聽聽聽聽聽 return getFoodDAO().get(id);
聽聽聽 }
聽聽聽 public void save(Food food) {
聽聽聽聽聽聽聽 getFoodDAO().save(food);
聽聽聽 }
聽聽聽 public void update(Food food) {
聽聽聽聽聽聽聽 getFoodDAO().update(food);
聽聽聽 }

}

spring xml 閰嶇疆錛?br />銆傘傘?br />聽聽聽聽聽聽聽聽聽 <bean id="lobHandler"
聽聽 聽聽聽 聽class="org.springframework.jdbc.support.lob.DefaultLobHandler"/>
聽聽 聽
聽聽 聽<bean id="transactionManager"
聽聽 聽聽聽 聽class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
聽聽 聽聽聽 聽<property name="dataSource" ref="dataSource"/>
聽聽 聽</bean>
聽聽 聽
聽聽 聽<bean id="sqlMapClient"
聽聽 聽聽聽 聽class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
聽聽 聽聽聽 聽<property name="dataSource" ref="dataSource"/>
聽聽 聽聽聽 聽<property name="configLocation">
聽聽 聽聽聽 聽聽聽 聽<value>SqlMapConfig.xml</value>
聽聽 聽聽聽 聽</property>
聽聽 聽聽聽 聽<property name="lobHandler" ref="lobHandler"/>
聽聽 聽</bean>
聽聽 聽
聽聽 聽<bean id="daoCreate" class="org.esoft.hdb.ibatis.IbatisDaoCreator">
聽聽 聽聽聽 聽<property name="sqlMapClient" ref="sqlMapClient"/>
聽聽 聽</bean>
聽聽 聽
聽聽 聽<bean id="foodService" class="org.esoft.hdb.service.FoodServiceImpl">
聽聽 聽聽聽 聽<property name="creator" ref="daoCreate"/>
聽聽 聽</bean>
聽聽 聽
聽聽 聽
聽聽 聽<aop:config>
聽聽 聽聽聽 聽<aop:pointcut id="foodServiceMethods"
聽聽 聽聽聽 聽聽聽 聽expression="execution(* org.esoft.hdb.service.FoodService.*(..))"/>
聽聽 聽聽聽 聽<aop:advisor advice-ref="txAdvice" pointcut-ref="foodServiceMethods"/>
聽聽 聽</aop:config>
聽聽 聽<tx:advice id="txAdvice" transaction-manager="transactionManager">
聽聽 聽聽聽 聽<tx:attributes>
聽聽 聽聽聽 聽聽聽 聽<tx:method name="*" propagation="REQUIRED"/>
聽聽 聽聽聽 聽</tx:attributes>
聽聽 聽</tx:advice>

綆鍗曠殑嫻嬭瘯錛?br />save :
聽聽聽 聽聽聽 Food food = new Food();
聽聽聽聽聽聽聽 food.setPk("1");
聽聽聽聽聽聽聽 food.setName("food1");
聽聽聽聽聽聽聽 BufferedInputStream in = new BufferedInputStream(getClass()
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 .getResourceAsStream("/1.gif"));
聽聽聽聽聽聽聽 byte[] b = FileCopyUtils.copyToByteArray(in);
聽聽聽聽聽聽聽 food.setImage(b);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 in = new BufferedInputStream(getClass().getResourceAsStream(
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "/hibernate.cfg.xml"));
聽聽聽聽聽聽聽 b = FileCopyUtils.copyToByteArray(in);
聽聽聽聽聽聽聽 food.setContent(new String(b));
聽聽聽聽聽聽聽 foodService.save(food);
update:
聽聽聽聽聽聽聽聽聽聽聽聽聽 Food food = foodService.get("1");
聽聽聽聽聽聽聽 BufferedInputStream in = new BufferedInputStream(getClass()
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 .getResourceAsStream("/jdbc.properties"));
聽聽聽聽聽聽聽 byte[] b = FileCopyUtils.copyToByteArray(in);
聽聽聽聽聽聽聽 food.setContent(new String(b));
聽聽聽聽聽聽聽 foodService.update(food);
聽聽聽聽聽聽聽 food = foodService.get("1");
聽聽聽聽聽聽聽 assertNotNull(food.getImage());

]]>
ibatis 寮濮嬩箣鏃?/title><link>http://www.tkk7.com/zyl/archive/2007/01/10/93001.html</link><dc:creator>甯冭。閮?/dc:creator><author>甯冭。閮?/author><pubDate>Wed, 10 Jan 2007 12:27:00 GMT</pubDate><guid>http://www.tkk7.com/zyl/archive/2007/01/10/93001.html</guid><wfw:comment>http://www.tkk7.com/zyl/comments/93001.html</wfw:comment><comments>http://www.tkk7.com/zyl/archive/2007/01/10/93001.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/zyl/comments/commentRss/93001.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/zyl/services/trackbacks/93001.html</trackback:ping><description><![CDATA[聽聽聽 鐢ㄤ簡寰堜箙hibernate 錛岀獊鐒舵兂鎹釜鍒殑orm 宸ュ叿錛屽綋鐒跺湪orm棰嗗煙涓紝hibernate鏄佸ぇ銆傜湅浜嗕竴涓媔batis錛屽彂鐜板鏋滃浜巆rud鎿嶄綔涓嶆槸寰堝鐨勭郴緇熸潵璇達紝鏄釜涓嶉敊鐨勯夋嫨錛屽挨鍏舵槸閫傚悎閭d簺瀵箂ql鍜屾ц兘鐑》鐨勫紑鍙戣呫傜患鍚堟潵璇磇batis涓嶈兘綆梠rm宸ュ叿錛屽彧鑳界畻涓崐鎴愬搧銆備笉榪囨瘮璧風洿鎺ョ敤jdbc鍐欙紝閭h繕鏄柟渚垮浜嗐備富瑕佺殑濂藉鏄垎紱諱簡sql鍜屼唬鐮侊紝濡傛灉浣犳兂榪芥眰鎬ц兘錛岄偅涔坰ql鏄綘寰堝ソ鐨勫埄鍣紝褰撶劧ibatis鐨勭紦瀛樹篃涓嶉敊銆傛瘮璧穐ibernate錛宨batis灝辯畝鍗曞浜嗭紝浼拌涔熷氨3澶╄兘澶熷熀鏈帉鎻′簡錛岃繖澶уぇ鍑忓皯浜嗗涔犳垚鏈?br />聽聽聽 璇翠簡閭d箞澶氬簾璇濓紝涓嬮潰寮濮嬫棰橈紝閫氳繃涓涓畝鍗曠殑瀹炰緥寮濮媔batis涔嬫梾錛屾枃绔犲ぇ閮ㄥ垎鍙傝冪綉涓婄殑ibatis 寮鍙戞寚鍗椾竴鏂囥?br />聽聽聽 涓昏鐨刯ar錛歩batis 2.3.0,spring 2.0.1,log4j 1.2.9,commons-logging 1.0.4,hsqldb 1.8.0<br />聽聽聽 <b>ibatis瀹炰緥閰嶇疆錛?/b><br />聽<br /><sqlMapConfig><br /><!-- 浜嬪姟閲囩敤spring 綆$悊 --><br />聽 <!--<br />聽 <transactionManager type="JDBC" commitRequired="false"><br />聽聽聽 <dataSource type="SIMPLE"><br />聽聽聽聽聽 <property name="JDBC.Driver" value="org.hsqldb.jdbcDriver"/><br />聽聽聽聽聽 <property name="JDBC.ConnectionURL" value="jdbc:hsqldb:hsql://localhost/xdb"/><br />聽聽聽聽聽 <property name="JDBC.Username" value="sa"/><br />聽聽聽聽聽 <property name="JDBC.Password" value=""/><br />聽聽聽 </dataSource><br />聽 </transactionManager><br />--><br />聽 <sqlMap resource="org/esoft/bo/xml/Account.xml"/><br /></sqlMapConfig>聽聽 聽 <br /><br /><b>鍒涘緩POJO瀵硅薄錛?/b><br /><br />聽<br />package com.esoft.bo;<br /><br />public class Account {<br /><br />聽聽聽 private String emailAddress;<br /><br />聽聽聽 private String firstName;<br /><br />聽聽聽 private int id;<br /><br />聽聽聽 private String lastName;<br /><br />聽聽聽 public String getEmailAddress() {<br />聽聽聽聽聽聽聽 return emailAddress;<br />聽聽聽 }<br /><br />聽聽聽 public String getFirstName() {<br />聽聽聽聽聽聽聽 return firstName;<br />聽聽聽 }<br /><br />聽聽聽 public int getId() {<br />聽聽聽聽聽聽聽 return id;<br />聽聽聽 }<br /><br />聽聽聽 public String getLastName() {<br />聽聽聽聽聽聽聽 return lastName;<br />聽聽聽 }<br /><br />聽聽聽 public void setEmailAddress(String emailAddress) {<br />聽聽聽聽聽聽聽 this.emailAddress = emailAddress;<br />聽聽聽 }<br /><br />聽聽聽 public void setFirstName(String firstName) {<br />聽聽聽聽聽聽聽 this.firstName = firstName;<br />聽聽聽 }<br /><br />聽聽聽 public void setId(int id) {<br />聽聽聽聽聽聽聽 this.id = id;<br />聽聽聽 }<br /><br />聽聽聽 public void setLastName(String lastName) {<br />聽聽聽聽聽聽聽 this.lastName = lastName;<br />聽聽聽 }<br /><br />}聽聽 聽 <br /><br /><b>鏄犲皠鏂囦歡</b>錛屾劅瑙夋瘮杈冪殑楹葷儲銆備互鍚庢湁鏈轟細鐨勮瘽涓瀹氳嚜鍔ㄧ敓鎴愭鏂囦歡錛屽挨鍏剁幇鍦╦pa褰撻亾銆?br />聽<br /><?xml version="1.0" encoding="UTF-8" ?><br /><br /><!DOCTYPE sqlMap聽聽聽聽 聽<br />聽聽聽 PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"聽聽聽聽 聽<br />聽聽聽 "http://ibatis.apache.org/dtd/sql-map-2.dtd"><br /><br /><sqlMap namespace="Account"><br />聽聽 聽<br />聽聽 聽<!-- Use type aliases to avoid typing the full classname every time. --><br />聽聽 聽<typeAlias alias="Account" type="com.esoft.bo.Account"/><br />聽聽 聽<br />聽聽 聽<!-- Result maps describe the mapping between the columns returned<br />聽聽 聽from a query, and the class properties.聽 A result map isn't<br />聽聽 聽necessary if the columns (or aliases) match to the properties <br />聽聽 聽exactly. --><br />聽聽 聽<resultMap id="AccountResult" class="Account"><br />聽聽 聽聽聽 聽<result property="id" column="ACC_ID"/><br />聽聽 聽聽聽 聽<result property="firstName" column="ACC_FIRST_NAME"/><br />聽聽 聽聽聽 聽<result property="lastName" column="ACC_LAST_NAME"/><br />聽聽 聽聽聽 聽<result property="emailAddress" column="ACC_EMAIL"/><br />聽聽 聽</resultMap><br />聽聽 聽<br />聽聽 聽<!-- Select with no parameters using the result map for Account class. --><br />聽聽 聽<select id="selectAllAccounts" resultMap="AccountResult"> <br />聽聽 聽聽聽 聽select * from ACCOUNT<br />聽聽 聽聽聽 聽</select><br />聽聽 聽<br />聽聽 聽<select id="selectByName" resultMap="AccountResult" parameterClass="String"><br />聽聽 聽聽聽 聽select * from Account where ACC_FIRST_NAME like #name#<br />聽聽 聽</select><br />聽聽 聽<br />聽聽 聽<!-- A simpler select example without the result map.聽 Note the <br />聽聽 聽aliases to match the properties of the target result class. --><br />聽聽 聽<select id="selectAccountById" parameterClass="int" resultClass="Account"><br />聽聽 聽聽聽 聽select ACC_ID as id, ACC_FIRST_NAME as firstName, ACC_LAST_NAME as lastName,<br />聽聽 聽聽聽 聽ACC_EMAIL as emailAddress from ACCOUNT where ACC_ID = #id# </select><br />聽聽 聽<br />聽聽 聽<!-- Insert example, using the Account parameter class --><br />聽聽 聽<insert id="insertAccount" parameterClass="Account"> insert into ACCOUNT ( ACC_ID,<br />聽聽 聽聽聽 聽ACC_FIRST_NAME, ACC_LAST_NAME, ACC_EMAIL) values ( #id#, #firstName#,<br />聽聽 聽聽聽 聽#lastName#, #emailAddress# ) </insert><br />聽聽 聽<br />聽聽 聽<!-- Update example, using the Account parameter class --><br />聽聽 聽<update id="updateAccount" parameterClass="Account"> update ACCOUNT set<br />聽聽 聽聽聽 聽ACC_FIRST_NAME = #firstName#, ACC_LAST_NAME = #lastName#, ACC_EMAIL =<br />聽聽 聽聽聽 聽#emailAddress# where ACC_ID = #id# </update><br />聽聽 聽<br />聽聽 聽<!-- Delete example, using an integer as the parameter class --><br />聽聽 聽<delete id="deleteAccountById" parameterClass="int"> delete from ACCOUNT where<br />聽聽 聽聽聽 聽ACC_ID = #id# </delete><br />聽聽 聽<br />聽聽 聽<delete id="clearAccount"> delete from ACCOUNT </delete><br />聽聽 聽<br /></sqlMap>聽聽 聽 <br /><br /><b>spring 閰嶇疆錛?/b><br />聽<br />...<br /><bean id="dataSource"<br />聽聽 聽聽聽 聽class="org.springframework.jdbc.datasource.DriverManagerDataSource"><br />聽聽 聽聽聽 聽<property name="driverClassName"><br />聽聽 聽聽聽 聽聽聽 聽<value>${jdbc.driverClassName}</value><br />聽聽 聽聽聽 聽</property><br />聽聽 聽聽聽 聽<property name="url"><br />聽聽 聽聽聽 聽聽聽 聽<value>${jdbc.url}</value><br />聽聽 聽聽聽 聽</property><br />聽聽 聽聽聽 聽<property name="username"><br />聽聽 聽聽聽 聽聽聽 聽<value>${jdbc.username}</value><br />聽聽 聽聽聽 聽</property><br />聽聽 聽聽聽 聽<property name="password"><br />聽聽 聽聽聽 聽聽聽 聽<value>${jdbc.password}</value><br />聽聽 聽聽聽 聽</property><br />聽聽 聽</bean><br />聽聽聽聽聽聽聽聽 <bean id="transactionManager"<br />聽聽 聽聽聽 聽class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><br />聽聽 聽聽聽 聽<property name="dataSource" ref="dataSource"/><br />聽聽 聽 </bean><br />聽聽 聽<br />聽聽聽聽聽聽 <bean id="sqlMapClient"<br />聽聽 聽聽聽 聽class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"><br />聽聽 聽聽聽 聽<property name="dataSource" ref="dataSource"/><br />聽聽 聽聽聽 聽<property name="configLocation"><br />聽聽 聽聽聽 聽聽聽 聽<value>SqlMapConfig.xml</value><br />聽聽 聽聽聽 聽</property><br />聽聽聽聽聽 </bean><br />聽聽聽聽聽 <bean id="accountDao" class="org.esoft.dao.AccountDaoImpl"><br />聽聽聽聽聽聽聽聽聽聽聽聽 <property name="sqlMapClient" ref="sqlMapClient"/><br />聽聽聽聽聽 </bean>聽聽 聽聽 聽<br />聽聽 聽 <br /><br /><b>涓昏鐨勪唬鐮侊細</b><br />public class AccountDaoImpl<br />聽聽聽聽聽聽聽 extends SqlMapClientDaoSupport {<br />聽聽聽 public PK save(Account obj) {<br />聽聽聽聽聽聽聽 return (PK) getSqlMapClientTemplate().insert("insertAccount", obj);<br />聽聽聽 }<br />聽聽聽 public void update(Accountobj) {<br />聽聽聽聽聽聽聽 getSqlMapClientTemplate().update("updateAccount", obj);<br />聽聽聽 }<br />聽聽聽聽 public void delete(Account obj) {<br />聽聽聽聽聽聽聽 getSqlMapClientTemplate().delete(<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "deleteAccountById",<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 obj.getPk());<br />聽聽聽 }<br />聽聽聽 public Account get(PK primaryKey) {<br />聽聽聽聽聽聽聽 return (Account) getSqlMapClientTemplate().queryForObject(<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "selectAccountById",<br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 primaryKey);<br />聽聽聽 }<br />}<br /><br /><br /><img src ="http://www.tkk7.com/zyl/aggbug/93001.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/zyl/" target="_blank">甯冭。閮?/a> 2007-01-10 20:27 <a href="http://www.tkk7.com/zyl/archive/2007/01/10/93001.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://miya863.com" target="_blank">亚洲性色精品一区二区在线</a>| <a href="http://wwwnewhtbook.com" target="_blank">亚洲国产精品综合一区在线</a>| <a href="http://www-993789.com" target="_blank">免费福利在线观看</a>| <a href="http://fenxiangceo.com" target="_blank">日本高清免费中文字幕不卡</a>| <a href="http://yuduruizhi.com" target="_blank">亚洲精华国产精华精华液好用</a>| <a href="http://222mp3.com" target="_blank">大陆一级毛片免费视频观看 </a>| <a href="http://c7372.com" target="_blank">日韩免费高清视频网站</a>| <a href="http://mysb123.com" target="_blank">亚洲无码一区二区三区</a>| <a href="http://wuhhz.com" target="_blank">日本免费一区尤物</a>| <a href="http://777cc55.com" target="_blank">黄色毛片免费网站</a>| <a href="http://qixiresort.com" target="_blank">久久亚洲色一区二区三区</a>| <a href="http://s8sb.com" target="_blank">青青操视频在线免费观看</a>| <a href="http://53reniao.com" target="_blank">亚洲国产精品自在在线观看</a>| <a href="http://ztxfkj.com" target="_blank">最近新韩国日本免费观看</a>| <a href="http://aabbcc567.com" target="_blank">亚洲一级免费毛片</a>| <a href="http://155562.com" target="_blank">国产成人青青热久免费精品</a>| <a href="http://yulongfilm.com" target="_blank">污视频网站在线免费看</a>| <a href="http://woaisouluo.com" target="_blank">2048亚洲精品国产</a>| <a href="http://w6446.com" target="_blank">午夜视频免费在线观看</a>| <a href="http://aqd1987.com" target="_blank">久久精品国产亚洲AV久</a>| <a href="http://wwwby1385.com" target="_blank">国产精品久久香蕉免费播放</a>| <a href="http://mcjc1.com" target="_blank">一级毛片aaaaaa视频免费看</a>| <a href="http://gzltchem.com" target="_blank">久久亚洲精品AB无码播放</a>| <a href="http://slmlxg.com" target="_blank">波多野结衣免费在线观看</a>| <a href="http://wwwby1378.com" target="_blank">久久久久久久久无码精品亚洲日韩</a>| <a href="http://saohu533.com" target="_blank">成人亚洲综合天堂</a>| <a href="http://888xxss.com" target="_blank">免费人成网站在线观看不卡</a>| <a href="http://199291.com" target="_blank">亚洲冬月枫中文字幕在线看</a>| <a href="http://71caoxee.com" target="_blank">国产又大又长又粗又硬的免费视频</a>| <a href="http://www66913.com" target="_blank">污污污视频在线免费观看</a>| <a href="http://xvwenyue.com" target="_blank">亚洲AV无码国产精品麻豆天美</a>| <a href="http://yamashida.com" target="_blank">精品香蕉在线观看免费</a>| <a href="http://6789311.com" target="_blank">国产亚洲视频在线播放大全</a>| <a href="http://woniuzn.com" target="_blank">国产亚洲婷婷香蕉久久精品</a>| <a href="http://fz166.com" target="_blank">国产妇乱子伦视频免费</a>| <a href="http://653349.com" target="_blank">色吊丝性永久免费看码</a>| <a href="http://7778kk.com" target="_blank">久久久亚洲欧洲日产国码二区</a>| <a href="http://fuhui123.com" target="_blank">免费黄色小视频网站</a>| <a href="http://otkaxap.com" target="_blank">APP在线免费观看视频</a>| <a href="http://tj-zhongfa.com" target="_blank">亚洲日韩国产AV无码无码精品</a>| <a href="http://xxxxxxxxcccc.com" target="_blank">国产精品亚洲综合一区</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>