[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1869) The MultipleHiloPertablegenerator.class wraps at 2**31-1, but javadoc claims Long.
Sylvain Mougenot (JIRA)
noreply at atlassian.com
Tue Jul 10 06:26:52 EDT 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27428 ]
Sylvain Mougenot commented on HHH-1869:
---------------------------------------
Because database numeric representation (that might be used for primary keys) is not limited to 32/64bits representation, why not upgrade this class to be as compliant (to big numbers) as possible by using BigInteger representation.
Actually I've encountered the problem of overflow using this class!!!!
Stack Trace sample:
HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.GenericJDBCException: could not get or update next value...
Caused by
java.sql.SQLException: JZ00B: Overflow numérique... (Localisation looks strange here)
(Caused by ResultSet.getInt() on a too large value stored in the database)
After one year no one seamed to take into account the consequences on users.
In my point of view this bug is Fatal :
- Database integrity is endangered or (at least)
- Application could not operate on concerned tables (our case)!
For so "trivial" changes fixing a big threat on users I hope there will be a fix soon!
Please vote!!!
> The MultipleHiloPertablegenerator.class wraps at 2**31-1, but javadoc claims Long.
> ----------------------------------------------------------------------------------
>
> Key: HHH-1869
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1869
> Project: Hibernate3
> Issue Type: Bug
> Components: core
> Affects Versions: 3.2.0 cr1
> Environment: All versions/all environments.
> Reporter: Jan Helge Salvesen
> Attachments: MultipleHiLoPerTableGenerator.zip
>
>
> The returntype of org.hibernate.id.MultipleHiloPertablegenerator.doWorkInCurrentTransaction are Serializable, and the javadoc states that this class shall return a Long (line 26 in source-file). But the value to be returned are, in fact, treated as an Integer and thus limited to 31-bits positive numbers (as an Integer). See line 163 in class, for instance. This behaviour will cause problems for sequence numbers above Integer.MAX_VALUE (that is 2**31-1). When this limit is exceeded, the actual returned "Long" are a huge-negative integer and may potentinally cause damage. The reason for Priority:Major is the fact that user of this class may have an old-fashon databasescheme, and for this reason, this error may become a "ticking bomb" waiting to a sequence number to exceed 2**31-1.
> The fixup are trivial. The internal representation of the number must be Long, and user shall be urged to upgrade to new release.
> I have attached a fixed version of the MultipleHiloPertablegenerator.java where the generated sequencenumber are treated as a long. I have allso tested my modified version and verified that the sequence-generation part on a Oracle system works as expected, which is that the generated sequence actually can exceed 2**31-1.
> (I have not tested the schema-generate-part, since this is not critical for user.)
--
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list