mybatis insert sql server 出错

ivocmn 2016-01-05 04:55:43
SRealData sRealData= new SRealData();
sRealData.setID("32232ddsdsd");
sRealData.setSHORT_ID("1");
sRealDataMapper.insertSelective(sRealData);

执行insert的时候报以下错误
DEBUG 2016-01-05 16:58:34,558 org.springframework.jdbc.datasource.DataSourceUtils: Fetching JDBC Connection from DataSource
DEBUG 2016-01-05 16:58:34,565 org.springframework.jdbc.datasource.DataSourceUtils: Returning JDBC Connection to DataSource
DEBUG 2016-01-05 16:58:34,565 org.springframework.jdbc.support.SQLErrorCodesFactory: Database product name cached for DataSource [com.alibaba.druid.pool.DruidDataSource@5553e3]: name is 'Microsoft SQL Server'
DEBUG 2016-01-05 16:58:34,567 org.springframework.jdbc.support.SQLErrorCodesFactory: SQL error codes for 'Microsoft SQL Server' found
DEBUG 2016-01-05 16:58:34,567 org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator: Unable to translate SQLException with Error code '8169', will now try the fallback translator
DEBUG 2016-01-05 16:58:34,568 org.springframework.jdbc.support.SQLStateSQLExceptionTranslator: Extracted SQL state class 'S0' from value 'S0002'
DEBUG 2016-01-05 16:58:34,569 org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver: Resolving exception from handler [com.voc.action.SrealDateAction@5eb17e]: org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
### The error may involve com.voc.dao.SRealDataMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: insert into s_real_data ( ID, SHORT_ID ) values ( ?, ? )
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
; uncategorized SQLException for SQL []; SQL state [S0002]; error code [8169]; Conversion failed when converting from a character string to uniqueidentifier.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
DEBUG 2016-01-05 16:58:34,571 org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver: Resolving exception from handler [com.voc.action.SrealDateAction@5eb17e]: org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
### The error may involve com.voc.dao.SRealDataMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: insert into s_real_data ( ID, SHORT_ID ) values ( ?, ? )
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
; uncategorized SQLException for SQL []; SQL state [S0002]; error code [8169]; Conversion failed when converting from a character string to uniqueidentifier.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
DEBUG 2016-01-05 16:58:34,571 org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver: Resolving exception from handler [com.voc.action.SrealDateAction@5eb17e]: org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
### The error may involve com.voc.dao.SRealDataMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: insert into s_real_data ( ID, SHORT_ID ) values ( ?, ? )
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
; uncategorized SQLException for SQL []; SQL state [S0002]; error code [8169]; Conversion failed when converting from a character string to uniqueidentifier.; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
DEBUG 2016-01-05 16:58:34,573 org.springframework.web.servlet.FrameworkServlet: Could not complete request
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to uniqueidentifier.
### The error may involve com.voc.dao.SRealDataMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: insert into s_real_data ( ID, SHORT_ID ) values ( ?, ? )
### Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Conversion failed when converting from a character string to



...全文
793 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
新IT民工 2016-01-06
  • 打赏
  • 举报
回复
你用util下面的 UUID uuid = UUID.randomUUID();
ivocmn 2016-01-05
  • 打赏
  • 举报
回复
GUID 在java中怎么生成?
spiritofdragon 2016-01-05
  • 打赏
  • 举报
回复
Conversion failed when converting from a character string to uniqueidentifier 有哪个字段是uniqueidentifier,对应程序的就是GUID。不是随便的string

703

社区成员

发帖
与我相关
我的任务
社区描述
提出问题
其他 技术论坛(原bbs)
社区管理员
  • community_281
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧