- 浏览: 198718 次
- 性别:
- 来自: 哈尔滨
文章分类
- 全部博客 (267)
- java.lang (8)
- 问题汇总 (21)
- 异常记录 (20)
- 功能实现 (19)
- 面试总结 (25)
- 技巧总结 (8)
- 常用代码 (4)
- 编程习惯 (3)
- 编码规则 (3)
- java.util (10)
- java.io (1)
- JavaWeb (9)
- MySQL (16)
- SVN (3)
- MyBatis (11)
- Velocity (7)
- 其他知识 (10)
- 人生哲理 (1)
- 人生故事 (1)
- 自我感悟 (1)
- shiro (3)
- 基础知识 (0)
- 问题总结 (1)
- Spring 标签 (1)
- Spring (3)
- 点滴生活 (1)
- DOS (1)
- CAS (4)
- Linux (9)
- Storm (6)
- Shell (1)
- regex (1)
- Collection (4)
- poi (1)
- 经典语句 (1)
- NIO (5)
- concurrent (14)
- RPC (1)
- zookeeper (3)
- 待整理 (2)
- Hadoop (9)
- RabbitMq (2)
- flume (1)
- hive (7)
- hbase (4)
- kafka (1)
- scala (1)
- GC (0)
- java.util.concurrent.atomic (1)
- java.lang.ref (6)
- JVM (2)
- algorithm (1)
- conception (1)
- java key word (1)
- sun.misc (1)
最新评论
问题场景:
服务启动正常,MyBatis Interface 中的接口调用时出现异常。
业务描述:
通过用户标识获取用户目前为止的所有投资收益。但测试使用的用户是新注册的用户,无投资金额。
问题分析:
DEBUG模式跟踪,发现底层mapper.xml 中的 SQL
此时 invest 为空 , sum (null) , 赋值给 double ,所以系统提示异常,尝试把一个 null值复制给 double 类型数据
问题结局:
1.添加函数判空处理
返回值时进行判断,若为空,则返回0
mapper的返回值,尽量使用包装类
2.修改mybatis 中 select 接口的 resultType = Double 改为 double
若结果为空,默认返回 0
服务启动正常,MyBatis Interface 中的接口调用时出现异常。
业务描述:
通过用户标识获取用户目前为止的所有投资收益。但测试使用的用户是新注册的用户,无投资金额。
问题分析:
DEBUG模式跟踪,发现底层mapper.xml 中的 SQL
select sum(invest) from db
此时 invest 为空 , sum (null) , 赋值给 double ,所以系统提示异常,尝试把一个 null值复制给 double 类型数据
问题结局:
1.添加函数判空处理
select IFNULL(sum(invest),0) FROM DB
返回值时进行判断,若为空,则返回0
mapper的返回值,尽量使用包装类
2.修改mybatis 中 select 接口的 resultType = Double 改为 double
若结果为空,默认返回 0
发表评论
-
Publishing failed with multiple errors file not found
2017-11-10 22:39 816问题场景: Java Web项目 ... -
attempted to return null from a method with a primitive return type (int)
2017-10-25 22:52 3138异常背景 mybatis mapper.xml 中 resul ... -
java.lang.UnsupportedOperationException
2017-10-24 21:42 332异常背景: 遍历集合进行元素删除操作 异常描述: Str ... -
can not find xxx.xxx
2017-10-03 10:20 370问题描述: 单元测试一个已离职同事的接口,运行时提示 po ... -
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '
2017-10-02 18:33 548问题场景: 启动 Tomcat 时报错,org.spring ... -
java.lang.OutOfMemoryError: Java heap space
2017-10-02 18:02 389问题描述: 新来的同事,安装JDK、Eclipse 、Tom ... -
No result defined for action
2017-09-26 21:56 545问题场景: 项目设计模式:SpringMVC 调试程序过程中 ... -
No matching bean of type dao found for depende
2017-09-26 21:46 823问题场景: 项目设计模式:Spring MVC + MyBat ... -
1030 Got error 28 from storage engine
2016-05-24 22:25 1274现象:调试程序过程中,突然报错,显示数据检索失败,数据库连接超 ... -
org.apache.shiro.session.UnknownSessionException
2015-06-27 18:19 3835问题说明: 背景:系 ... -
java Excel poi exception
2015-06-11 16:41 640一、 问题:java导出Exce ... -
The reference to entity "locale" must end with the ';' delimiter.
2015-06-02 15:12 1778问题: 修改web.xml 文件中的拦击器中的URL后 报错T ... -
xxxList not found
2015-05-20 08:51 629问题:MyBatis接口中以list作为参数类型,在mappe ... -
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JD
2015-05-17 16:39 576问题:运行单元测试类(比较重载与重写的区别)时报错, ERRO ... -
Result Maps collection already contains value for mapper.XXX
2015-05-14 08:53 2085问题:运行单元测试类时报错 原因:应该用resultMap来 ... -
Unable to find resource
2015-05-13 20:32 701场景: 配合JS调试时,出现上面的异常,且数据可以正常接收,程 ... -
target is null for setProperty
2015-05-13 15:00 691问题:ognl.OgnlException: target i ... -
语法错误,查询条件中带有多余的单引号
2015-05-07 09:27 686场景:列表检索功能,查询条件中带有英文单引号,点击查询,系统异 ... -
unable to install breakpoint in
2015-05-05 16:55 584避免出现这种错误 说明:尝试了多种方式仍然未能解决,与其煞费 ...
相关推荐
Kernel panic - not syncing: Attempted to kill init 解决办法 开源成就技术;技术成就梦想
ARM 启动 后显示Kernel panic(Attempted to kill init!)
Automatic mapping from Java to native functions, with simple mappings for all primitive data types Runs on most platforms which support Java Automatic conversion between C and Java strings, with ...
回车<return> 继续打开下一行; b 另外开上一屏; f 另外开下一屏; h 帮助; q或Ctrl+C 退出; /字符串 从上往下查找匹配的字符串; ?字符串 从下往上查找匹配的字符串; n 继续查找。 四、退出命令 ...
For this reason, very few commercial products have attempted to provide an ASP-to-HTML converter. The problem with such converters is that you must work in conjunction with the Web server to trigger ...
本人最近在玩树莓派4B的时候,树莓派在烧录镜像之后,无法启动,一直卡死在end kernel panic not syncing: attempted to kill init! exitcode = 0x00000000b 环境 设备:树莓派4B 查找原因–树莓派官网 根据官网给...
This book is targeted at a broad audience, but in a nutshell–to anyone who wants to learn more about cloud computing. Cloud computing has become a hot topic in recent years, and people at different ...
For this reason, very few commercial products have attempted to provide an ASP-to-HTML converter. The problem with such converters is that you must work in conjunction with the Web server to trigger ...
This is a great reference book." How many times have you attempted to learn JavaScript, only to put it on the side because it was too complex or you just felt overwhelmed by the information overload?...
Finance is about managing money. It is about making provisions and allocations of ...The Appendix contains a brief introduction to R, for those not acquainted with this software language.
This book is for anyone who may have recently heard the term “cloud computing” for the first time and needs to ... We have attempted to fill this book with a broad range of resources and information.
We have attempted to make every algorithm accessible and interesting. To help you when you encounter unfamiliar or difficult algorithms, we describe each one in a step-bystep manner. We also provide ...
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value ...
attempted to present some element of the topic for a particular audience. In this book, I do not make the assumption that you are a particular type of reader, nor do I assume that you are approaching ...
主要介绍了SVN出现提示org.apache.subversion.javahl.ClientException: Attempted to lock an already-locked dir解决方案的相关资料,需要的朋友可以参考下
Attempted to assign to readonly property报错 起因:项目中写了个点击事件,增加动态效果,类似于转一转,rotate(360)。很简单的一个特效。 设置元素的transition:transform 1s。 然后动态改变元素的transfrom:...
Graph Theory has become an important ...and presentation of material, it has been attempted to accommodate elementary concepts on essential basis so as to offer guidance to those new to the field.
Use a version of BurnInTest prior to 5.2 for compatibility with W98 and ME. Windows 95 and Windows NT ========================= Windows 95 and NT are not supported in BurnInTest version 4.0 and above...