没有合适的资源?快使用搜索试试~ 我知道了~
首页提升iBATIS-3开发体验:避免代码复制问题
提升iBATIS-3开发体验:避免代码复制问题
![](https://csdnimg.cn/release/wenkucmsfe/public/img/star.98a08eaa.png)
iBATIS-3开发指南是一份详细的文档,旨在帮助开发者理解和使用iBATIS 3框架进行数据库操作。该文档特别强调了在阅读过程中不要直接复制代码示例,因为现代的文字处理工具如Word可能会插入特殊的字符,这些字符可能与实际编程环境中的预期不符,导致代码无法正确运行。例如,文档中的引号和连字符可能会在文本编辑器或集成开发环境中显示错误,无法达到预期的代码引用效果。 文档鼓励读者亲自尝试下载附带的示例代码,包括单元测试等,这些例子通常经过精心编排,可以在实际项目环境中无缝应用。此外,官方推荐从官方网站、邮件列表或者iBATIS社区获取更准确的代码示例,以便确保代码的正确性和一致性。 作者呼吁读者如果发现文档有不足之处,比如某个功能的文档缺失,最好的解决方案是自己去学习这个功能,然后将所学内容反馈回来,甚至可以直接通过开源社区的wiki平台(<http://opensource.atlassian.com/confluence/oss/display/IBATIS/Contribute+Documentation>)贡献自己的文档。这样不仅可以提升文档质量,也能促进整个iBATIS 3社区的成长。 iBATIS-3开发指南是一个实用的资源,适合希望深入了解并熟练掌握iBATIS 3技术的开发人员。在阅读过程中,不仅要关注理论知识,还要结合实战案例和官方提供的支持,这样才能更好地利用iBATIS 3进行高效、稳定的数据库操作。同时,文档鼓励用户积极参与,共同维护和完善文档内容,使之成为一个全面且具有时效性的学习参考。
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/2499466/bgb.jpg)
iBATIS 3 - User Guide
3 May 2010 11
environment
transactionManager
dataSource
o mappers
properties
These are externalizable, substitutable properties that can be configured in a typical Java Properties file
instance, or passed in through sub-elements of the properties element. For example:
<properties resource="org/apache/ibatis/example/config.properties">
<property name="username" value="dev_user"/>
<property name="password" value="F2Fa3!33TYyg"/>
</properties>
The properties can then be used throughout the configuration files to substitute values that need to be
dynamically configured. For example:
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
The username and password in this example will be replaced by the values set in the properties
elements. The driver and url properties would be replaced with values contained from the
config.properties file. This provides a lot of options for configuration.
Properties can also be passed into the SqlSessionBuilder.build() methods. For example:
SqlSessionFactory factory =
sqlSessionFactoryBuilder.build(reader, props);
// ... or ...
SqlSessionFactory factory =
sqlSessionFactoryBuilder.build(reader, environment, props);
If a property exists in more than one of these places, iBATIS loads them in the following order:
Properties specified in the body of the properties element are read first,
Properties loaded from the classpath resource or url attributes of the properties element are
read second, and override any duplicate properties already specified ,
Properties passed as a method parameter are read last, and override any duplicate properties
that may have been loaded from the properties body and the resource/url attributes.
Thus, the highest priority properties are those passed in as a method parameter, followed by
resource/url attributes and finally the properties specified in the body of the properties element.
![](https://csdnimg.cn/release/download_crawler_static/2499466/bgc.jpg)
iBATIS 3 - User Guide
3 May 2010 12
settings
These are extremely important tweaks that modify the way that iBATIS behaves at runtime. The
following table describes the settings, their meanings and their default values.
Setting
Description
Valid Values
Default
cacheEnabled
Globally enables or disables any caches
configured in any mapper under this
configuration.
true | false
true
lazyLoadingEnabled
Globally enables or disables lazy loading.
When disabled, all associations will be eagerly
loaded.
true | false
true
aggressiveLazyLoading
When enabled, an object with lazy loaded
properties will be loaded entirely upon a call
to any of the lazy properties. Otherwise, each
property is loaded on demand.
true | false
true
multipleResultSetsEnabled
Allows or disallows multiple ResultSets to be
returned from a single statement (compatible
driver required).
true | false
true
useColumnLabel
Uses the column label instead of the column
name. Different drivers behave differently in
this respect. Refer to the driver
documentation, or test out both modes to
determine how your driver behaves.
true | false
true
useGeneratedKeys
Allows JDBC support for generated keys. A
compatible driver is required. This setting
forces generated keys to be used if set to
true, as some drivers deny compatibility but
still work (e.g. Derby).
true | false
False
autoMappingBehavior
Specifies if and how iBATIS should
automatically map columns to
fields/properties. PARTIAL will only auto-
map simple, non-nested results. FULL will
auto-map result mappings of any complexity
(nested or otherwise).
NONE,
PARTIAL,
FULL
PARTIAL
defaultExecutorType
Configures the default executor. SIMPLE
executor does nothing special. REUSE
executor reuses prepared statements. BATCH
executor reuses statements and batches
updates.
SIMPLE
REUSE
BATCH
SIMPLE
defaultStatementTimeout
Sets the timeout that determines how long
the driver will wait for a response from the
database.
Any positive
integer
Not Set
(null)
An example of the settings element fully configured is as follows:
<settings>
<setting name="cacheEnabled" value="true"/>
![](https://csdnimg.cn/release/download_crawler_static/2499466/bgd.jpg)
iBATIS 3 - User Guide
3 May 2010 13
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="enhancementEnabled" value="false"/>
<setting name="defaultExecutorType" value="SIMPLE"/>
<setting name="defaultStatementTimeout" value="25000"/>
</settings>
typeAliases
A type alias is simply a shorter name for a Java type. It's only relevant to the XML configuration and
simply exists to reduce redundant typing of fully qualified classnames. For example:
<typeAliases>
<typeAlias alias="Author" type="domain.blog.Author"/>
<typeAlias alias="Blog" type="domain.blog.Blog"/>
<typeAlias alias="Comment" type="domain.blog.Comment"/>
<typeAlias alias="Post" type="domain.blog.Post"/>
<typeAlias alias="Section" type="domain.blog.Section"/>
<typeAlias alias="Tag" type="domain.blog.Tag"/>
</typeAliases>
With this configuration, “Blog” can now be used anywhere that “domain.blog.Blog” could be.
There are many built-in type aliases for common Java types. They are all case insensitive, note the
special handling of primitives due to the overloaded names.
Alias
Mapped Type
_byte
byte
_long
long
_short
short
_int
int
_integer
int
_double
double
_float
float
_boolean
boolean
string
String
byte
Byte
long
Long
short
Short
int
Integer
integer
Integer
double
Double
float
Float
boolean
Boolean
date
Date
decimal
BigDecimal
bigdecimal
BigDecimal
剩余62页未读,继续阅读
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![-](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/aeac1bc2ce854d4086bb8748d94cd146_d66380022.jpg!1)
追求进步的阶梯
- 粉丝: 9
- 资源: 13
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
最新资源
- 解决本地连接丢失无法上网的问题
- BIOS报警声音解析:故障原因与解决方法
- 广义均值移动跟踪算法在视频目标跟踪中的应用研究
- C++Builder快捷键大全:高效编程的秘密武器
- 网页制作入门:常用代码详解
- TX2440A开发板网络远程监控系统移植教程:易搭建与通用解决方案
- WebLogic10虚拟内存配置详解与优化技巧
- C#网络编程深度解析:Socket基础与应用
- 掌握Struts1:Java MVC轻量级框架详解
- 20个必备CSS代码段提升Web开发效率
- CSS样式大全:字体、文本、列表样式详解
- Proteus元件库大全:从基础到高级组件
- 74HC08芯片:高速CMOS四输入与门详细资料
- C#获取当前路径的多种方法详解
- 修复MySQL乱码问题:设置字符集为GB2312
- C语言的诞生与演进:从汇编到系统编程的革命
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)