Author: steve.ebersole(a)jboss.com
Date: 2007-01-31 18:46:25 -0500 (Wed, 31 Jan 2007)
New Revision: 11124
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/id/TableHiLoGenerator.java
Log:
HHH-2397 : TableHiLo overflow
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/id/TableHiLoGenerator.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/id/TableHiLoGenerator.java 2007-01-31
23:46:11 UTC (rev 11123)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/id/TableHiLoGenerator.java 2007-01-31
23:46:25 UTC (rev 11124)
@@ -50,15 +50,16 @@
returnClass = type.getReturnedClass();
}
- public synchronized Serializable generate(SessionImplementor session, Object obj)
+ public synchronized Serializable generate(SessionImplementor session, Object obj)
throws HibernateException {
if (maxLo < 1) {
//keep the behavior consistent even for boundary usages
- int val = ( (Integer) super.generate(session, obj) ).intValue();
+ long val = ( (Number) super.generate(session, obj) ).longValue();
+ if (val == 0) val = ( (Number) super.generate(session, obj) ).longValue();
return IdentifierGeneratorFactory.createNumber( val, returnClass );
}
if (lo>maxLo) {
- int hival = ( (Integer) super.generate(session, obj) ).intValue();
+ long hival = ( (Number) super.generate(session, obj) ).longValue();
lo = (hival == 0) ? 1 : 0;
hi = hival * (maxLo+1);
log.debug("new hi value: " + hival);
Show replies by date