- 浏览: 7851651 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (2425)
- 软件工程 (75)
- JAVA相关 (662)
- ajax/web相关 (351)
- 数据库相关/oracle (218)
- PHP (147)
- UNIX/LINUX/FREEBSD/solaris (118)
- 音乐探讨 (1)
- 闲话 (11)
- 网络安全等 (21)
- .NET (153)
- ROR和GOG (10)
- [网站分类]4.其他技术区 (181)
- 算法等 (7)
- [随笔分类]SOA (8)
- 收藏区 (71)
- 金融证券 (4)
- [网站分类]5.企业信息化 (3)
- c&c++学习 (1)
- 读书区 (11)
- 其它 (10)
- 收藏夹 (1)
- 设计模式 (1)
- FLEX (14)
- Android (98)
- 软件工程心理学系列 (4)
- HTML5 (6)
- C/C++ (0)
- 数据结构 (0)
- 书评 (3)
- python (17)
- NOSQL (10)
- MYSQL (85)
- java之各类测试 (18)
- nodejs (1)
- JAVA (1)
- neo4j (3)
- VUE (4)
- docker相关 (1)
最新评论
-
xiaobadi:
jacky~~~~~~~~~
推荐两个不错的mybatis GUI生成工具 -
masuweng:
(转)JAVA获得机器码的实现 -
albert0707:
有些扩展名为null
java 7中可以判断文件的contenttype了 -
albert0707:
非常感谢!!!!!!!!!
java 7中可以判断文件的contenttype了 -
zhangle:
https://zhuban.me竹板共享 - 高效便捷的文档 ...
一个不错的网络白板工具
在ibatis2中,要注意动态列,动态表是可以使用的,比如:
select $filelist from assetlocationmapping where $colname$ = #colvalue#
然后
Map deleteinAssetLocationMapping=new HashMap();
deleteinAssetLocationMapping.put("colname",colname);
deleteinAssetLocationMapping.put("colvalue",colvalue)
就是传一个MAP进去,就可以实现动态列了,但要注意,在配置文件中,
要加上:
<select id="selectBySql" resultClass="java.util.HashMap"
remapResults="true">中的remapResults="true",默认为FALSE,参考手册说明如下:
Proper Usage of remapResults="true"
The remapResults attribute is available on 【statement】, 【select】, and 【procedure】 mapped statements. It is an optional attribute and the default value is false.
The remapResults attribute should be set to true when a query has a variable set of return columns. For example, consider the following queries:
在 【statement】, 【select】, 和【procedure】 标签中存在一个可选的属性【remapResults】,默认值是false.
如果每次查询的列不定的话,这个属性需要设置为true.如下所例:
xml 代码
SELECT $fieldList$
FROM table
In this example, the list of column names is dynamic, even though the table is always the same.
在这个例子中,虽然检索的是同一张表,可是每次查询的列却是可变的。
xml 代码
SELECT *
FROM $someTable$
In this example, the table could be different. Because of the usage of * in the SELECT clause, the resulting columns names could be different, as well.
在这个例子中,因为在Select中使用了*匹配符,所以查询的列会随着表名的不同而发生变化。
Since the overhead to introspect the result set metadata is not trivial, iBATIS will remember what was returned the last time the query was run. This could create problems in situations similar to the examples above.
为了避免经常的对返回的结果进行内省,iBATIS会记录上一次查询结果的元数据,这样,在遇到上面的例子时就会出现问题。
Let's consider what iBATIS will do for the first example depending on the usage of remapResults.
让我们了解一下,iBATIS是如何依赖remapResults属性的。
Without remapResults, or remapResults="false":
当没有设置remapResults属性,或者设置remapResults为false时:
Let's say $fieldList$ is set to "fld1, fld2" the first time the query is executed, thus giving the query:
假设在第一次查询时,$fieldList$设置为"fld1, fld2" ,查询语句等效下面的SQL:
xml 代码
SELECT fld1, fld2
FROM table
iBATIS will try to be efficient by assuming that fld1 and fld2 will always be in the result set on each subsequent execution of the query.
The application will run into trouble if the value for $fieldList$ changes, such as "fld3, fld4". Not only will iBATIS be unable to find fld1 and fld2 in the result set,
thus returning improper results, iBATIS won't know about fld3 and fld4 because they weren't in the query on its initial execution.
iBATIS为了效率,假设这条SQL语句今后的查询结果都会返回fld1和fld2列。
如果后面$fieldList$发生变化,比如设置为 "fld3, fld4",程序将会遇到一些麻烦。不仅仅是iBATIS找不到fld1和fld2列那么简单,
麻烦的是,iBATIS也不会识别fld3和fld4,因为在SQL初始化的时候,这两列并没有包括在内。
With remapResults="true":
iBATIS will introspect the result set metadata every time the query is run and will always return the proper results. This feature comes at some performance cost, so only use it if you really need it – when the columns in the result set are variable, either directly, like in the first example, or indirectly, because of a variable table.
当设置remapResults为"true"时:
iBATIS会在每次查询的时候内省查询结果来设置元数据,来保证返回恰当的结果。这个属性会造成一定的性能损失,所以要谨慎使用,只在你需要的时候使用--查询列发生变化,直接的,如第一个例子一样,或者隐含的,如第二个例子,检索的表发生变化。
select $filelist from assetlocationmapping where $colname$ = #colvalue#
然后
Map deleteinAssetLocationMapping=new HashMap();
deleteinAssetLocationMapping.put("colname",colname);
deleteinAssetLocationMapping.put("colvalue",colvalue)
就是传一个MAP进去,就可以实现动态列了,但要注意,在配置文件中,
要加上:
<select id="selectBySql" resultClass="java.util.HashMap"
remapResults="true">中的remapResults="true",默认为FALSE,参考手册说明如下:
Proper Usage of remapResults="true"
The remapResults attribute is available on 【statement】, 【select】, and 【procedure】 mapped statements. It is an optional attribute and the default value is false.
The remapResults attribute should be set to true when a query has a variable set of return columns. For example, consider the following queries:
在 【statement】, 【select】, 和【procedure】 标签中存在一个可选的属性【remapResults】,默认值是false.
如果每次查询的列不定的话,这个属性需要设置为true.如下所例:
xml 代码
SELECT $fieldList$
FROM table
In this example, the list of column names is dynamic, even though the table is always the same.
在这个例子中,虽然检索的是同一张表,可是每次查询的列却是可变的。
xml 代码
SELECT *
FROM $someTable$
In this example, the table could be different. Because of the usage of * in the SELECT clause, the resulting columns names could be different, as well.
在这个例子中,因为在Select中使用了*匹配符,所以查询的列会随着表名的不同而发生变化。
Since the overhead to introspect the result set metadata is not trivial, iBATIS will remember what was returned the last time the query was run. This could create problems in situations similar to the examples above.
为了避免经常的对返回的结果进行内省,iBATIS会记录上一次查询结果的元数据,这样,在遇到上面的例子时就会出现问题。
Let's consider what iBATIS will do for the first example depending on the usage of remapResults.
让我们了解一下,iBATIS是如何依赖remapResults属性的。
Without remapResults, or remapResults="false":
当没有设置remapResults属性,或者设置remapResults为false时:
Let's say $fieldList$ is set to "fld1, fld2" the first time the query is executed, thus giving the query:
假设在第一次查询时,$fieldList$设置为"fld1, fld2" ,查询语句等效下面的SQL:
xml 代码
SELECT fld1, fld2
FROM table
iBATIS will try to be efficient by assuming that fld1 and fld2 will always be in the result set on each subsequent execution of the query.
The application will run into trouble if the value for $fieldList$ changes, such as "fld3, fld4". Not only will iBATIS be unable to find fld1 and fld2 in the result set,
thus returning improper results, iBATIS won't know about fld3 and fld4 because they weren't in the query on its initial execution.
iBATIS为了效率,假设这条SQL语句今后的查询结果都会返回fld1和fld2列。
如果后面$fieldList$发生变化,比如设置为 "fld3, fld4",程序将会遇到一些麻烦。不仅仅是iBATIS找不到fld1和fld2列那么简单,
麻烦的是,iBATIS也不会识别fld3和fld4,因为在SQL初始化的时候,这两列并没有包括在内。
With remapResults="true":
iBATIS will introspect the result set metadata every time the query is run and will always return the proper results. This feature comes at some performance cost, so only use it if you really need it – when the columns in the result set are variable, either directly, like in the first example, or indirectly, because of a variable table.
当设置remapResults为"true"时:
iBATIS会在每次查询的时候内省查询结果来设置元数据,来保证返回恰当的结果。这个属性会造成一定的性能损失,所以要谨慎使用,只在你需要的时候使用--查询列发生变化,直接的,如第一个例子一样,或者隐含的,如第二个例子,检索的表发生变化。
发表评论
-
复习:强迫线程顺序执行方式
2019-01-03 23:42 1476方法1: 三个线程,t1,t2,t3,如果一定要按顺序执行, ... -
(转)不错的前后端处理异常的方法
2019-01-02 23:16 1965前言 在 Web 开发中, 我们经常会需要处理各种异常, 这是 ... -
info q的极客时间大咖说等资料下载
2018-08-15 08:40 3411info q的极客时间大咖说等资料下载,还有不少思维导图 链 ... -
CXF 客户端超时时间设置(非Spring配置方式)
2018-07-03 22:38 2182import org.apache.cxf.endpoint. ... -
(转)synchronized关键字画像:正确打开方式
2018-06-14 09:25 446https://mp.weixin.qq.com/s/b3Sx ... -
CountDownLatch的例子
2018-06-13 14:10 628public class StatsDemo { ... -
两道面试题,带你解析Java类加载机制
2018-06-12 16:29 551https://mp.weixin.qq.com/s/YTa0 ... -
Spring中获取request的几种方法,及其线程安全性分析
2018-06-11 09:03 621https://mp.weixin.qq.com/s/KeFJ ... -
内部类小结
2018-06-06 10:25 394https://mp.weixin.qq.com/s/hErv ... -
JVM虚拟机小结1
2018-06-04 20:43 4611 jps -l //列出详细的类名和进程ID 2)jps ... -
windows下自带命令行工具查看CPU资源情况等
2018-06-04 12:53 3038微软提供了不少命令行 ... -
(收藏)深入分析Java的序列化与反序列化
2018-05-30 15:21 553https://mp.weixin.qq.com/s/T2Bn ... -
apache common包中的序列化工具
2018-05-30 09:10 1773什么是序列化 我们的 ... -
JAVA8 JVM的变化: 元空间(Metaspace)
2018-05-24 22:30 904本文将会分享至今为至我收集的关于永久代(Permanent G ... -
(转)服务器性能指标(一)——负载(Load)分析及问题排查
2018-05-21 21:03 1262原创: Hollis Hollis 负载 ... -
(转)对象复用
2018-05-20 15:27 804public class Student { priv ... -
mapreduce中入门中要注意的几点
2018-05-06 08:59 617在 mapreduce中,比如有如下的词: I love b ... -
HDFS的基本操作
2018-05-02 21:47 878-mkdir 在HDFS创建目录 ... -
一个不错的开源工具类,专门用来解析日志头部的,好用
2018-05-02 20:00 705一个不错的开源工具类,专门用来解析日志头部的,好用。 http ... -
介绍个不错的RESTFUL MOCK的工具wiremock
2018-04-27 21:02 1852介绍个不错的RESTFUL MOCK的工具wiremock,地 ...
相关推荐
ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南ibatis2指南
ibatis官方中文文档.rar包含ibatis官方中文文档及使用说明
ibatis学习 ibatis总结 ibatis ibatis ibatis
开发环境说明 ...本示例完整地结合Struts2+Spring2+iBatis2+MySQL5,演示了一个用户表的增、删、改、查。 想完整学习Struts2+Spring+iBatis的同仁,可以在这个例子中学习或模仿最基本也是最核心的技术要点。
1.iBatis2学习笔记:基本原理和配置.doc 2.iBatis2学习笔记:与Spring2的整合.doc 3.iBatis2学习笔记:单表映射 .doc 4.iBatis2学习笔记:SqlMap的配置总结(18条).doc 5.iBatis2学习笔记:入参和返回值的问题.doc ...
ibatis3.0中in的用法ibatis3.0中in的用法ibatis3.0中in的用法ibatis3.0中in的用法
ibatis2.0中文API ibatis2.0中文API ibatis2.0中文API 一对多 多对一详解,属性设置详解,解决方案详解,ibatis2.0核心API
ibatis+struts2 Demo,ibatis简单的增删改查
可以帮你将 ibatis 2.x sqlmap 文件转换为 myBatis 3.x mapper 文件,该工具是使用了 Ant 构建任务进行 XSTL 转换和一些语法文字替换 该工具下载下来使用非常简单,把你要转换的所有 sqlmap 文件放到 source 文件夹...
struts2+ibatis+Spring
iBATIS学习总结
ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料
struts2spring2ibatis2
iBATIS 文档 iBATIS 文档 iBATIS 文档
iBATIS-DAO-2.pdf
ibatis2源码与分析
ibatis 乱码解决 ibatis乱码 gbk iso_8859_1 乱码
Struts2+IBatis整合
Struts2 Spring iBATIS 架构 实现 Struts2 Spring iBATIS 架构 实现 Struts2 Spring iBATIS 架构 实现 Struts2 Spring iBATIS 架构 实现
ibatis demo,ibatis例子,ibatis示例