GHGL项目总结-mybatis
来源:互联网 发布:变声器玩游戏知乎 编辑:程序博客网 时间:2024/06/05 20:29
1、<![CDATA[ ]]>作用
标记避免Sql中与xml规范相冲突的字符对xml映射文件的合法性造成影响
<![CDATA[ rownum <= #{NUM} ]]>
2、写增删改时,语句没问题,但是没执行
,可能是因为没有session.commit();
3、批量提交数据
int a = 2000;//每次提交2000条 int loop = (int) Math.ceil(list.size() / (double) a); //一共提交多少次 int start, stop; //start:每次提交数据开始数,stop:每次提交的结束数 // 查询表的全部数据 oracle可以使用 for (int i = 0; i < loop; i++) { tempList.clear(); //每次清空数据 start = i * a; //开始次数赋值 stop = Math.min(i * a + a - 1, list.size() - 1); //结束时取值 System.out.println("range:" + start + " - " + stop); for (int j = start; j <= stop; j++) { tempList.add(list.get(j)); } baseDepartmentDao.batchUpdate(tempList); //执行业务 session.commit(); //提交 session.clearCache(); //清除缓存 System.out.println("已经插入" + (stop + 1) + " 条");
4、打印sql语句到控制台
http://blog.csdn.net/qq_17555933/article/details/51656253
5、问题:Unable to translate SQLException with Error code '17004', will now try the fallback translator
解决:http://m.blog.csdn.net/article/details?id=17489337
Error code 907 缺失右括号
6、标签的使用
Sql和include
抽象相同的sql
7、 Mybatis 批量插入带oracle序列例子+ORA-02287: 此处不允许序号
一直返回-1,用这种方法就不返回。
http://blog.csdn.net/dr_lf/article/details/41380303
8、Parameter 'DECIMAL' not found. Available parameters are [list]
这个问题是
#{item.zgrs,jdbcType=INTEGER} 当带有jdbctype这个关键字时,不能用$取值,
还有就是jdbctype和javatype类型对应问题。Oracle 和mysql
9、attempted to return null from a method with a primitive return type (double).
把返回值double改成Double,因为返回为空时double报错
Double countGzzeByQybmAndJfssq(@Param("qybm")String qybm ,@Param("jfssq")String jfssq);
10、批量修改
<update id="batchUpdateStudentWithMap" parameterType="java.util.Map" >
UPDATE STUDENT SET name = #{name} WHERE id IN
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
11、error code 911
错误原因:
多一个分号“;”
12、Error querying database. Cause: java.sql.SQLException: 无法转换为内部表示
数据库中字段类型和程序中不对应
13、 Error setting null for parameter #10 with JdbcType OTHER .
http://blog.csdn.net/wangxmin2005/article/details/19753871
mybatis 插入空值時需要指定jdbcType
14、org.apache.ibatis.reflection.ReflectionException: There is no getter for property named '' in 'class com.djzh.core.pojo.FundsReserved'
Mapper.xml中取参数在这个实体中找不到
- GHGL项目总结-mybatis
- GHGL项目总结-spring+mybatis多数据库源
- GHGL项目总结-Myeclipse
- GHGL项目总结-Oracle
- GHGL项目总结-DB2
- GHGL项目总结-CA
- GHGL项目最后总结
- GHGL项目总结-TIPS系统和银行拨付
- GHGL项目功能代码
- GHGL项目-其他问题锦集
- GHGL项目-RSA加解密导致内存泄漏
- Spring SpringMVC Mybatis项目总结
- 项目总结:spring+mybatis整合
- 项目总结: MyBatis-paginator实现分页
- mybatis 项目错误总结(一)
- springMVC和MyBatis项目中的bug总结
- GHGL工具类代码
- 项目总结2——mybatis配置的理解
- [JS]map用法(待完善)
- cocos
- react-native 的项目reading学习一
- Android面试(六)JAVA
- 安装easyphp5.2后出现unexpected end of mysql...see log file?不能重启mysql的解决方法
- GHGL项目总结-mybatis
- 【系统测试】性能测试总结
- 双磁盘安装win10和centos 7之后的一些配置工作
- RTTI学习笔记
- js兼容性
- 多线程问题汇总
- Ubiquitous Religions (简单并查集)
- Yii (1.1)调用数据库
- jq绑定事件方法及区别