JavaEE企业级开发知识点总结

如果总分110分,你能打几分?
 
 
1. SpringMVC 的 配 置 文 件 中 , 定 义 控 制 器 搜 索 路 径 的 标 记 是<context:component-scan>
2. 表单的请求参数可以自动注入给控制器的同名形参。
3. SpringMVC 的控制器响应 JSON 数据需要在控制器前注解 @ResponseBody
4. MyBatis 中,
MyBatis 的缓存分为一级缓存和二级缓存;
、二级缓存可以被所有的 SqlSession 共享;
、在映射文件中默认是没有开启二级缓存的,开启二级缓存需要使用 cache 标签;
5. 通过以下配置判断, Goods 类中可能有一个 List 集合
<resultMap id="goodsResultMap" type="com.isoft.pojo.Goods">
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="price" column="price"/>
<collection property="goodImgs" resultMap="goodsResultMap"/>
</resultMap>
6. 如下配置:
<select id="sqlLog" parameterType="appLog" resultType="appLog">
select * from t_applog where
<if test="title!=null">
title=#{title}
</if>
<if test="content!=null">
and content=#{content}
</if>
</select>
、这个配置存在问题,当第一个 if 语句不成立时 Where 后面紧跟 and 是一个错误的
SQL 语句,将出现运行时异常
、为了解决 title null 时的运行时异常我们可以用 <where> 标签把所有 <if> 包含起来
、为了解决 title null 时的运行时异常我们可以用 <trim prefix= whereprefixOverrides=
and | or ></trim> 把所有 <if> 包含起来,并把 where 去掉。
7. 关于 MyBatis 的全局配置文件中, settings 元素设置项的默认值为 false 的是
useGeneratedKeys
8. 在一个 MyBatis 的应用中,关于 SlqSessionFactoryfBuilder SqlSessionFactory 以及
SqlSession 的应用范围和生命周期, SlqSessionFactoryfBuilder 的最佳范围是方法范围,即可以定义为本地方法变量
SqlSessionFactory 的最佳范围是应用范围
SqlSession 的最佳范围是方法范围或请求范围
9. Mybatis 可以利用 Sql 映射文件配置,也可以利用 Annotation 来设置,基本注解的是
@Arg @Case @Results
10. @One 注解,复杂类型的单独属性映射。
11. SpringMVC 中使用注解 @Controller 定义控制器。
12. SpringMVC 中,当前控制器返回值应该包括字符串 forward 才能保证携带请求数据
跳转到另一个控制器。
13. 在请求的过程中, SpringMVC 使用接口 Converter 的实现类完成数据类型转换。
14. 以下关于 MyBatis 的使用场景描述
、 当希望对象的持久化对应用程序完全透明时不适合使用 MyBatis
、当数据库有移植需求或需要支持多种数据库时不适合使用 MyBatis
、当应用程序需要完全动态的 sql 时不适合使用 MyBatis
15. MyBatis Mapper 文件中,
<select id="queryUserById" resultType="hashmap" parameterType="int">
<![CDATA[select * from user u where u.id=#{id} ]]>
</select>
<delete id="deleteUserById" parameterType="int">
<![CDATA[delete from user u where u.id=#{id} ]]>
</delete>
<update id="updateUser" parameterType="User">
<![CDATA[update user set username=#{username},passwd=#{passwd} where id=#{id} ]]>
</update>
16. 如果想让 MyBatis 将日志信息输出到屏幕,
<settings>
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
17. Mybatis 中,关于 <resultmap> <collection> 元素 <collection> 通过 property 属性指定实体类中集合属性的名字;
<collection> 通过 javaType 属性指定实体类中元素的类型;
<collection> 通过 javaType 属性指定集合的类型;
18. Mybatis 中,关于 ResultType
resultType 表示返回值类型为:完整类名或别名, MyBatis 也允许使用基本的数据
类型,包括 String int 类型;
resultType resultMap 的数据结构是一样的,都是 Map
resultType resultMap 不能同时使用;
19. Mybatis 注解的标签是 @select @udpate @delte
20. 注解 @RequestMapping() 主要用来定义控制器的请求名称,该标记可以放置的位置
是可以在方法和类前。
21. SpringMVC 中,使用注解 @SessionAttributes 指定 Session 属性。
22. SpringMVC 实现国际化操作中,使用 Spring 标签 <spring:message> 完成国际化信息
的显示。
23. ResultType 取值
<select id="selectPersonCount" resultType="int">
select count(*) from person
</select>
<select id="selectPersonCount" resultType="_int">
select count(*) from person
</select>
<select id="selectPersonCount" resultType="java.lang.Integer">
select count(*) from person
</select>
24. 如果想让 MyBatis 将日志信息输出到屏幕,则:
<settings>
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
25. MyBatis 的使用场景描述
、当希望对象的持久化对应用程序完全透明时不适合使用 MyBatis
、当数据库有移植需求或需要支持多种数据库时不适合使用 MyBatis
、当应用程序需要完全动态的 sql 时不适合使用 MyBatis
26. @Arg
  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值