yxhxj2006
导航
BlogJava
首页
新随笔
联系
聚合
管理
<
2012年9月
>
日
一
二
三
四
五
六
26
27
28
29
30
31
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
2
3
4
5
6
留言簿
(7)
给我留言
查看公开留言
查看私人留言
随笔分类
J2EE(17)
(rss)
java(13)
(rss)
Javascipt
(rss)
Linux(3)
(rss)
PHP(4)
(rss)
SQL(12)
(rss)
励志(3)
(rss)
测试
(rss)
文章分类
paypal
(rss)
随笔档案
2016年6月 (1)
2015年12月 (1)
2015年11月 (1)
2015年10月 (1)
2015年8月 (1)
2015年6月 (1)
2015年5月 (3)
2015年4月 (6)
2015年3月 (1)
2015年2月 (4)
2015年1月 (4)
2014年12月 (6)
2014年11月 (1)
2014年9月 (3)
2014年6月 (2)
2014年5月 (5)
2014年4月 (3)
2014年3月 (3)
2014年2月 (15)
2014年1月 (11)
2013年12月 (1)
2013年11月 (8)
2013年10月 (6)
2013年9月 (2)
2013年8月 (19)
2013年7月 (1)
2013年6月 (1)
2013年5月 (3)
2013年4月 (3)
2013年3月 (5)
2012年12月 (3)
2012年11月 (4)
2012年10月 (1)
2012年9月 (25)
2012年8月 (54)
2012年7月 (10)
2012年6月 (7)
阅读排行榜
1. Hibernate实现有两种配置,xml配置与注释配置(49837)
2. 公钥与私钥 (42324)
3. 使用POI读取EXCEL中的所有Sheet表 (25889)
4. Maven实战(六)依赖(11934)
5. Oracle中把一个查询结果插入到一张表中(11021)
评论排行榜
1. 公钥与私钥 (31)
2. Hibernate实现有两种配置,xml配置与注释配置(4)
3. Java通过URL获取网站Html源代码 (3)
4. 让HTML中的文本框中的文字垂直居中 .(3)
5. struts2表单传值(2)
常用链接
我的随笔
我的评论
我的参与
最新评论
统计
随笔 - 228
文章 - 0
评论 - 53
引用 - 0
最新评论
1. re: 公钥与私钥
评论内容较长,点击标题查看
--chinaltang
2. re: 如何在magento中建立自定义页面
请问站长,你这个增加以下片段是在哪里增加的,还有你这是怎么显示出来页面呢,总要点击页面上的哪个东西跳转到这个页面吧,那点击跳转怎么操作
--王小丫
3. re: 公钥与私钥
343434
--zhangsa
4. re: 公钥与私钥
真的写的非常好,通俗易懂,但是不知道有demo没有,要是有求一份。
--Divella
5. re: Hibernate实现有两种配置,xml配置与注释配置[未登录]
sa
--sa
iBatis中使用动态查询
iBatis中的动态查询还是比较好用的
如果想深入学习,可以参考 Manning.iBATIS.in.Action.Jan.2007
下面给出几个例子和dtd定义:
<select id="selectDispatchedKey" parameterClass="KeyAndKeyFlowInfo" resultMap="KeyAndKeyFlowResult">
select distinct
KEY_ID,
USER_ID,
INITIATOR,
INIT_DATE,
INITIATOR_EMAIL,
SGS_KEY.BRANCH_NAME,
APPROVER,
APPROVER_EMAIL,
APPROVE_DATE
from
SGS_KEY,
SGS_KEY_FLOW
where SGS_KEY.APPLY_FLOW_ID=SGS_KEY_FLOW.KEY_FLOW_ID
<dynamic prepend="and" open="(" close=")">
<isNotNull property="ki.userId" prepend="and" removeFirstPrepend="false">
USER_ID = #ki.userId#
</isNotNull>
<isNotNull property="kfi.initiator" prepend="and">
INITIATOR = #kfi.initiator#
</isNotNull>
<isNotNull property="kfi.initDate" prepend="and">
INIT_DATE = #kfi.initDate#
</isNotNull>
</dynamic>
</select>
<update id="updateKeyFlow" parameterClass="KeyFlowInfo">
update SGS_KEY_FLOW set
<dynamic>
KEY_FLOW_ID =#keyFlowId#
<isNotNull property="branchName" prepend=",">
BRANCH_NAME = #branchName#
</isNotNull>
<isNotEqual property="operation" prepend="," compareProperty="operation" compareValue="0">
OPERATION = #operation#
</isNotEqual>
<isNotNull property="initiator" prepend=",">
INITIATOR = #initiator#
</isNotNull>
<isNotNull property="initiatorEmail" prepend=",">
INITIATOR_EMAIL = #initiatorEmail#
</isNotNull>
<isNotNull property="initDate" prepend=",">
INIT_DATE = #initDate#
</isNotNull>
<isNotNull property="approver" prepend=",">
APPROVER = #approver#
</isNotNull>
<isNotNull property="approverEmail" prepend=",">
APPROVER_EMAIL = #approverEmail#
</isNotNull>
<isNotNull property="approveDate" prepend=",">
APPROVE_DATE = #approveDate#
</isNotNull>
<isNotEqual property="keyNum" prepend="," compareProperty="keyNum" compareValue="0">
KEY_NUM = #keyNum#
</isNotEqual>
<isNotNull property="applyReason" prepend=",">
APPLY_REASON = #applyReason#
</isNotNull>
<isNotNull property="rejectReason" prepend=",">
REJECT_REASON = #rejectReason#
</isNotNull>
</dynamic>
where
KEY_FLOW_ID =#keyFlowId#
</update>
0:26 2008-2-20补充:
让iBatis中的insert返回主键 [ibatis insert 返回 自增主键]
iBatis SQL-map 文件书写注意事项
http://ibatis.apache.org/dtd/sql-map-2.dtd 中有<dynamic>的定义
<!-- - - - - - - - - - - - - - - - - - - - - - - - - <br> DYNAMIC ELEMENTS <br>- - - - - - - - - - - - - - - - - - - - - - - - -->
<!ELEMENT dynamic (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST dynamic >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
>
<!ELEMENT isNotNull (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isNotNull >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
>
<!ELEMENT isNull (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isNull >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
>
<!ELEMENT isNotPropertyAvailable (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isNotPropertyAvailable >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #REQUIRED
removeFirstPrepend (true|false) #IMPLIED
>
<!ELEMENT isPropertyAvailable (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isPropertyAvailable >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #REQUIRED
removeFirstPrepend (true|false) #IMPLIED
>
<!ELEMENT isEqual (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isEqual >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
compareProperty CDATA #IMPLIED
compareValue CDATA #IMPLIED
>
<!ELEMENT isNotEqual (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isNotEqual >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
compareProperty CDATA #IMPLIED
compareValue CDATA #IMPLIED
>
<!ELEMENT isGreaterThan (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isGreaterThan >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
compareProperty CDATA #IMPLIED
compareValue CDATA #IMPLIED
>
<!ELEMENT isGreaterEqual (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isGreaterEqual >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
compareProperty CDATA #IMPLIED
compareValue CDATA #IMPLIED
>
<!ELEMENT isLessThan (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isLessThan >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
compareProperty CDATA #IMPLIED
compareValue CDATA #IMPLIED
>
<!ELEMENT isLessEqual (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isLessEqual >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
compareProperty CDATA #IMPLIED
compareValue CDATA #IMPLIED
>
<!ELEMENT isEmpty (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isEmpty >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
>
<!ELEMENT isNotEmpty (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isNotEmpty >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
>
<!ELEMENT isParameterPresent (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isParameterPresent >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
>
<!ELEMENT isNotParameterPresent (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST isNotParameterPresent >
prepend CDATA #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
removeFirstPrepend (true|false) #IMPLIED
>
<!ELEMENT iterate (#PCDATA | include | iterate | isParameterPresent | isNotParameterPresent | isEmpty | isNotEmpty | isNotNull | isNull | isNotEqual | isEqual | isGreaterThan | isGreaterEqual | isLessThan | isLessEqual | isPropertyAvailable | isNotPropertyAvailable)*>
<!ATTLIST iterate >
prepend CDATA #IMPLIED
property CDATA #IMPLIED
removeFirstPrepend (true|false|iterate) #IMPLIED
open CDATA #IMPLIED
close CDATA #IMPLIED
conjunction CDATA #IMPLIED
>
posted on 2012-09-20 00:54
奋斗成就男人
阅读(977)
评论(0)
编辑
收藏
新用户注册
刷新评论列表
只有注册用户
登录
后才能发表评论。
网站导航:
博客园
IT新闻
Chat2DB
C++博客
博问
管理
Powered by:
BlogJava
Copyright © 奋斗成就男人