您的位置:首页 > 编程语言 > Java开发

Unsigned JdbcType is resolved to only signed JavaType , which won't it overflow?

2018-01-13 14:47 609 查看


Unsigned JdbcType is resolved to only signed JavaType , which won't it overflow? #314

51Bigod opened this issue 2 days ago · 3 comments


Comments

  


51Bigod commented 2
days ago

For Example , SMALLINT is resolved to Short ,

The scope of the Short is -32768 ~ 32767,

The scope of the Signed SMALLINT is also -32768 ~ 32767,

but

The scope of the Unsigned SMALLINT is also 0 ~ 65535,

which won't it overflow?
  
 


51Bigod commented 2
days ago • 

edited 

Thank you for your contribution , I think I've got the answer by The MBG documents
MySql supports both signed, and unsigned, numeric fields. These are not JDBC types, so MyBatis generator cannot automatically
account for these types of fields. The Java data types are always signed. This can lead to a loss of precision when using unsigned fields. The solution is to provide a <columnOverride> for any unsigned numeric field in MySql

 
Owner


jeffgbutler commented a
day ago

This is how MySql works. You'll need to do the 
<columnOverride>

http://www.mybatis.org/generator/usage/mysql.html href="https://github.com/mybatis/generator/issues/314#event-1421108742" target=_blank>

  
 


51Bigod commented a
minute ago

I see , Thanks for your help
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐