From: Jan H. S. (JIRA) <no...@at...> - 2006-06-30 14:02:31
|
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 Type: Bug Components: core 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 |