]
Guenther Demetz commented on HHH-7060:
--------------------------------------
Following the procedure I used to convert tinyint columns into smallint without loosing
data (SQLServer2008):
alter table MyTable
add byteValueTrans smallint null
GO
update MyTable
set byteValueTrans = byteValue
where byteValue between 0 and 127
update MyTable
set byteValueTrans = byteValue - 256
where byteValue between 128 and 256
GO
alter table MyTable
drop column byteValue
GO
sp_rename 'MyTable.byteValueTrans', 'byteValue', 'COLUMN'
Add support for mode that causes SQL Server dialect to treat
application as semantically authoritative in regards to Java types and their value ranges
------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-7060
URL:
https://hibernate.onjira.com/browse/HHH-7060
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.0
Reporter: John Verhaeg
Assignee: John Verhaeg
In particular, there is a disconnect between the value ranges supported by bytes in Java
vs. SQL Server: Java byte values are 1 byte, unsigned, while SQL Server values are 0-255.
Previously, negative byte values stored in the Java model would be treated as unsigned
bytes by the driver, allowing the reading and writing of such values to "work"
from the standpoint of the application, but also resulting in a completely different
positive value being stored within the database. HHH-6815 addressed this disconnect from
the standpoint of ensuring values set in the Java model were kept semantically in tact
within the database and forcing the use of SMALLINT columns instead of TINYINT columns for
byte values. However, this solution assumes it's important that the database values
exactly match what's in the Java model. It also does not allow for existing databases
with existing TINYINT columns, which end up experiencing exceptions when negative byte
values are persisted and later retrieved. The proposed solution is to offer some type of
mode that can be set by the user to indicate the Java model should be treated as
authoritative wrt data values, which would cause Hibernate to perform as it did in
previous releases.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: