apache / apache/incubator-seata

Gts does a date type operation in DML and reports org.apache.ibatis.type.TypeException

Open
#1,253 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.

### Ⅰ. Issue Description
在使用springboot操作数据库时,mysql指定了创建时间类型为datatime格式,但是做dml操作时,会出现类型类型映射问题,

### Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

```
==> Preparing: update system_message set status_code_key = ?, function_module_id = ?, message_title= ?, include_variable_flag = ?, gmt_create = ? where 1=1 and system_message_id = ? and is_deleted = 0
Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2bf2fb75]
Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2bf2fb75]
Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2bf2fb75]
2019-06-28 18:28:51 - com.meizhilab.basis.system.common.GenericExceptionHandler -34218 [http-nio-8082-exec-1] ERROR com.meizhilab.basis.system.common.GenericExceptionHandler - 未知异常
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='gmtCreate', mode=IN, javaType=class java.time.LocalDateTime, jdbcType=DATE, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 with JdbcType DATE . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Error

```

### Ⅲ. Describe what you expected to happen
对时间格式的数据,能正常dml,ddl

### Ⅳ. How to reproduce it (as minimally and precisely as possible)
对没有jdbcType映射的sql去操作dml,可能会发生这个问题

### Ⅴ. Anything else we need to know?
在kt.mybatis做操作的时候,使用gts-client需要做哪些必要的操作?

### Ⅵ. Environment:

- JDK version :1.8.0_181
- OS :MCOS
- Others:springboot

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named. Start by reproducing the Spring Boot/MyBatis update using a MySQL datetime column, a Java LocalDateTime value, and the shown jdbcType DATE mapping; then compare behavior with and without the GTS client. Done means the datetime DML operation completes without the org.apache.ibatis.type.TypeException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql, spring-boot
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.