MyBatis之select
来源:互联网 发布:喀秋莎录屏软件录微课 编辑:程序博客网 时间:2024/05/22 06:59
查询语句是使用 MyBatis 时最常用的元素之一
timeout 设置驱动器在抛出异常前等待回应的最长时间,默认为不设值,由驱动器自己决定true|falsefalsetimeout设置驱动器在抛出异常前等待回应的最长时间,默认为不设值,由驱动器自己决定正整数未设置fetchSize设置一个值后,驱动器会在结果集数目达到此数值后,激发返回,默认为不设值,由驱动器自己决定正整数驱动器决定statementTypestatement,preparedstatement,callablestatement。
预准备语句、可调用语句STATEMENT
PREPARED
CALLABLEPREPAREDresultSetTypeforward_only,scroll_sensitive,scroll_insensitive
只转发,滚动敏感,不区分大小写的滚动FORWARD_ONLY
SCROLL_SENSITIVE
SCROLL_INSENSITIVE驱动器决定
select元素配置细节如下
属性描述取值默认id在这个模式下唯一的标识符,可被其它语句引用 parameterType传给此语句的参数的完整类名或别名 resultType语句返回值类型的整类名或别名。注意,如果是集合,那么这里填写的是集合的项的整类名或别名,而不是集合本身的类名。(resultType 与resultMap 不能并用) resultMap引用的外部resultMap 名。结果集映射是MyBatis 中最强大的特性。许多复杂的映射都可以轻松解决。(resultType 与resultMap 不能并用) flushCache如果设为true,则会在每次语句调用的时候就会清空缓存。select 语句默认设为falsetrue|falsefalseuseCache如果设为true,则语句的结果集将被缓存。select 语句默认设为false true|false falsetimeout 设置驱动器在抛出异常前等待回应的最长时间,默认为不设值,由驱动器自己决定true|falsefalsetimeout设置驱动器在抛出异常前等待回应的最长时间,默认为不设值,由驱动器自己决定正整数未设置fetchSize设置一个值后,驱动器会在结果集数目达到此数值后,激发返回,默认为不设值,由驱动器自己决定正整数驱动器决定statementTypestatement,preparedstatement,callablestatement。
预准备语句、可调用语句STATEMENT
PREPARED
CALLABLEPREPAREDresultSetTypeforward_only,scroll_sensitive,scroll_insensitive
只转发,滚动敏感,不区分大小写的滚动FORWARD_ONLY
SCROLL_SENSITIVE
SCROLL_INSENSITIVE驱动器决定
示例:
<resultMap id="detailResultMap" type="com.myapp.domain.Blog"> <id column="id" property="id" jdbcType="INTEGER"/> <result column="author_id" property="authorId" jdbcType="INTEGER" /> <result column="title" property="title" jdbcType="VARCHAR" /> <collection property="posts" ofType="com.myapp.domain.Post"> <id column="postId" property="id"></id> <result column="blog_id" property="blogId"></result> <result column="subject" property="subject"/> </collection> </resultMap> <select id="getBlogs" resultMap="detailResultMap" parameterType="com.myapp.domain.Author"> select b.title,b.id,b.author_id,c.id as postId,c.subject from Blog b left join Post c on (b.id=c.blog_id and b.author_id=c.author_id) where b.author_id=#{id} </select>
- MyBatis之select
- MyBatis之select
- Mybatis 之 select
- MyBatis之select
- Mybatis之select元素
- MyBatis之select
- MyBatis —— 映射配置之select
- 【MyBatis】MyBatis的学习笔记之<select>标签
- Mybatis-select
- Mybatis-Select
- mybatis--mapper映射文件配置之select,resultMap
- mybatis 查询select语句
- Mybatis源码 select分析
- MyBatis中select语句
- mybatis:查询Select
- Mybatis select查询语句
- mybatis-映射器-select
- MyBatis select标签
- SQL多表连接查询(详细实例)
- java保留两位小数4种方法
- 试卷分析的四个度:难度、区分度、信度、效度
- SQL多表连接查询
- openCV平滑函数----cvSmooth
- MyBatis之select
- Windows启动参数揭秘
- HttpContext类
- c++写修改Windows服务类型的代码
- tomcat增大内存
- SQL连接查询的方式
- java.net.MalformedURLException: unknown protocol: g ; jdom2 ;
- IT职场人生系列之二十三:知识体系(专家与杂家)
- 计算机学习进阶