[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936?page=c...
]
Julien Kronegg commented on HHH-1936:
-------------------------------------
The proposed file IdentifierGeneratorFactory.java (# 14444 ) would not work for very high
value because of this code snippet:
else if ( clazz==BigDecimal.class ) {
return new BigDecimal( rs.getLong(1) );
}
If the database table primary key is a DECIMAL(21) or longer, (silent) overflow will occur
since the max value is 10^21-1 for DECIMAL(21) and Long has a max value of 2^63-1, which
is lower than 10^21-1.
You would use rs.getBigDecimal(1) instead of new BigDecimal( rs.getLong(1) )
The same would probably occur for the following code snippet:
else if ( clazz==BigInteger.class ) {
return new BigInteger( "" + rs.getInt(1) );
}
IdentityGenerator doesn't support BigInteger as a valid identity
type.
----------------------------------------------------------------------
Key: HHH-1936
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1936
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.0.5
Environment: Hibernate 3.0.5, Sybase 12.05, Window/ Unix
Reporter: Leonid Shtivelman
Attachments: IdentifierGeneratorFactory.java
Identity generator strategy doesn't support BigInteger as a valid id type. This
causes problem with Sybase which requires identity column to be numeric. It would seem an
obvious way to get around this problem is to set column mapping to long in hibernate xml
and the actual java object. This will solve obvious problem of creating identity, but
will cause performance problem on selection. In order for Sybase to use index for
parameter query the variable type of the parameter and column index type has to be the
same. If ones maps column type to Long, Hibernate will use JDBC method setLong(long) to
set value in the prepared statement. This will cause mismatch between parameter type and
column index type, and Sybase will not use index to locate index. As you can see this is
a big problem for anyone that is using identity columns Sybase and Hibernate
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira