Mybatis分装对象是,将数据“HHH:mm:ss”这种格式的数据按照时间类型分装然后抛出异常,
解决方法:使用字符串连接函数 CONCAT(SEC_TO_TIME(floor(d.stay_time/start_num)))
部分错误信息如下:
org.springframework.dao.TransientDataAccessResourceException:
### Error querying database. Cause: java.sql.SQLException: Bad format for Time '308:42:13' in column 6### The error may exist in file [C:\caoj\workspace-dev\zhkj_oms\src\main\webapp\WEB-INF\classes\mappings\modules\user\TUserDao.xml]
### The error may involve com.zhkj.modules.user.dao.TUserDao.findRegistrationStatisticsList
### The error occurred while handling results
### SQL: select SEC_TO_TIME(floor(d.stay_time/start_num)) once_long_time from user d;
### Cause: java.sql.SQLException: Bad format for Time '308:42:13' in column 6
; SQL []; Bad format for Time '308:42:13' in column 6; nested exception is java.sql.SQLException: Bad format for Time '308:42:13' in column 6
本文介绍了一个关于MyBatis处理特定格式时间数据时出现的异常情况,并提供了解决方案。异常出现在尝试将HHH:mm:ss格式的数据作为时间类型处理时,通过使用SQL函数CONCAT(SEC_TO_TIME(...))进行转换得以解决。
1466

被折叠的 条评论
为什么被折叠?



