[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-6779) ByteType mapped to tinyint, but on sybase/ms sql server, tinyint is unsigned int
Steve Ebersole (JIRA)
noreply at atlassian.com
Tue Nov 1 16:04:22 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6779?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44213#comment-44213 ]
Steve Ebersole commented on HHH-6779:
-------------------------------------
For sake of completeness, Sybase defines its {{TINYINT}} datatype as 0-128; SQL Server defines it as 0-255. Neither of which match with the JDBC {{TINYINT}} definition.
Neither define a data type {{NUMBER}} afaik. They use the ANSI term {{DECIMAL}} (or {{NUMERIC}}, as a synonym).
Unfortunately there does not seem to be a direct corollary to the JDBC {{TINYINT}} type in Sybase or SQL Server. Both {{SMALLINT}} and {{DECIMAL(3,0)}} represented wasted storage space as far as storing a Java {{byte}} value. However, I agree that this is the only viable solution *as far as our tests go*.
However we still have a potential issue there with existing apps trying to store out of range values into columns defined as type {{TINYINT}}. This fix will not change that behavior. This fix just makes the column data type bigger moving forward.
> ByteType mapped to tinyint, but on sybase/ms sql server, tinyint is unsigned int
> --------------------------------------------------------------------------------
>
> Key: HHH-6779
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6779
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.6.8, 4.0.0.CR5
> Environment: sybase, sql server
> Reporter: Strong Liu
>
> ByteType maps tinyint and byte
> which byte on java is [-128,127]
> but on sybase / sql server, the tinyint scope is [0-128)
> this causes org.hibernate.test.typedescriptor.ByteTest fail, stace trace is same as HHH-3679
> change the mapping of tinyint to number(3,0) in org.hibernate.dialect.AbstractTransactSQLDialect would fix this issue
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list