日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ibatis学习笔记(三)java实体跟表映射.xml文件详解

發(fā)布時(shí)間:2025/3/21 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ibatis学习笔记(三)java实体跟表映射.xml文件详解 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
在項(xiàng)目中使用Ibatis難免會(huì)使用到java實(shí)體跟表映射.xml.

?

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "
http://ibatis.apache.org/dtd/sql-map-2.dtd" >
<sqlMap namespace="ALARM_CAUSE" >
<typeAlias type="com.metarnet.ipnms.alarm.model.AlarmCause" alias="alarmCause"/> <!--
給實(shí)體類的一個(gè)別名,方面下文引用-->
? <resultMap id="AlarmCauseResult" class="alarmCause" >??<!-- javabean
跟數(shù)據(jù)庫表列的映射
-->
??? <result column="CAUSE_ID" property="causeId" jdbcType="DECIMAL" />
??? <result column="CAUSE_NAME" property="causeName" jdbcType="VARCHAR" />
??? <result column="CAUSE_NAME_CN" property="causeNameCn" jdbcType="VARCHAR" />
??? <result column="ALARM_LEVEL" property="alarmLevel" />
??? <result column="LEVEL_NAME" property="levelName" jdbcType="VARCHAR" />
??? <result column="CAUSE_NAME_CN" property="causeNameCn" jdbcType="VARCHAR" />
??? <result column="ALARM_DESC" property="alarmDesc" jdbcType="VARCHAR" />
??? <result column="RESID" property="resid" jdbcType="VARCHAR" />
? </resultMap>

? <sql id="ALARM_CAUSE_Example_Where_Clause" ><!--?動(dòng)態(tài)的生成SQL?-->
??? <iterate property="oredCriteria" conjunction="or" prepend="where" removeFirstPrepend="iterate" >
????? <isEqual property="oredCriteria[].valid" compareValue="true" >
??????? (
??????? <iterate prepend="and" property="oredCriteria[].criteriaWithoutValue" conjunction="and" >
????????? $oredCriteria[].criteriaWithoutValue[]$
??????? </iterate>
??????? <iterate prepend="and" property="oredCriteria[].criteriaWithSingleValue" conjunction="and" >
????????? $oredCriteria[].criteriaWithSingleValue[].condition$
??????????? #oredCriteria[].criteriaWithSingleValue[].value#
??????? </iterate>
??????? <iterate prepend="and" property="oredCriteria[].criteriaWithListValue" conjunction="and" >
????????? $oredCriteria[].criteriaWithListValue[].condition$
????????? <iterate property="oredCriteria[].criteriaWithListValue[].values" open="(" close=")" conjunction="," >
??????????? #oredCriteria[].criteriaWithListValue[].values[]#
????????? </iterate>
??????? </iterate>
??????? <iterate prepend="and" property="oredCriteria[].criteriaWithBetweenValue" conjunction="and" >
????????? $oredCriteria[].criteriaWithBetweenValue[].condition$
????????? #oredCriteria[].criteriaWithBetweenValue[].values[0]# and
????????? #oredCriteria[].criteriaWithBetweenValue[].values[1]#
??????? </iterate>
??????? )
????? </isEqual>
??? </iterate>
? </sql>

<!--?查詢語句標(biāo)簽返回一個(gè)結(jié)果集?如果返回多個(gè)結(jié)果集則用 resultMap 如果返回單個(gè)結(jié)果集則用resultClass="AlarmCauseResult"?-->
? <select id="ALARM_CAUSE_selectAllAlarmCause" resultMap="AlarmCauseResult">
??????<!--? select statement? -->

? </select>
????
??<!--?
刪除語句標(biāo)簽ibatis中默認(rèn)的刪除語句是返回?cái)?shù)據(jù)庫受影響的行數(shù)
?-->
? <delete id="ALARM_CAUSE_deleteByPrimaryKey" parameterClass="com.metarnet.ipnms.alarm.model.AlarmCause" >
????????????<!--? delete? statement? -->

? </delete>

???<!--新增語句標(biāo)簽返回?cái)?shù)據(jù)庫受影響的行數(shù)?-->
? <insert id="ALARM_CAUSE_insert" parameterClass="com.metarnet.ipnms.alarm.model.AlarmCause" >
???<!--? insertstatement? -->? </insert>

?

?<!--修改語句標(biāo)簽返回?cái)?shù)據(jù)庫受影響的行數(shù)?-->
? <update id="ALARM_CAUSE_updateByPrimaryKey" parameterClass="com.metarnet.ipnms.alarm.model.AlarmCause">

??????<!-- update statement -->
???? </update>

<procedure id="ALARM_CAUSE_getById" parameterMap="" >

??? {? = call alarm.getSingleDetailRows(?)}

</procedure>

? </sqlMap>

java實(shí)體跟數(shù)據(jù)庫表的映射到此結(jié)束了。

轉(zhuǎn)載于:https://www.cnblogs.com/huangt/p/3667170.html

總結(jié)

以上是生活随笔為你收集整理的ibatis学习笔记(三)java实体跟表映射.xml文件详解的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。