[Hibernate] Table generators and int/long etc
All table hilo generators are actually using rs.setInt() rs.getInt() I've always been incomfortable with that. What do you think of this proposal? If nobody complains, I can implement that for 3.1 http://forum.hibernate.org/viewtopic.php?p=2269441#2269441 I am attempting to use the hilo generator where the column is a long. Looking at the TableHiLoGenerator class, it appears to me that the generation goes through a step in which it is converted to an int. The particular method is: TableGenerator.doWorkInCurrentTransaction(Connection conn, String sql) Within this method, we perform the select query to get the next value, then perform the update to increment the counter. However, we extract the select query resultSet with: result = rs.getInt(1); And we update the query with: ups.setInt( 1, result + 1 ); ups.setInt( 2, result ); If I'm not mistaken, those ...Int() methods are bugs. Instead, these get/set methods should be delegated to the IdentifierGeneratorFactory class (which has a get method but would need a set).
RE: [Hibernate] Table generators and int/long etc
Title: RE: [Hibernate] Table generators and int/long etc The int value coming from the table is combined with a the high value to produce a larger value. I don't see a problem here. -Original Message- From: [EMAIL PROTECTED] on behalf of Emmanuel Bernard Sent: Thu 11/3/2005 5:01 AM To: Hibernate development Subject: [Hibernate] Table generators and int/long etc All table hilo generators are actually using rs.setInt() rs.getInt() I've always been incomfortable with that. What do you think of this proposal? If nobody complains, I can implement that for 3.1 http://forum.hibernate.org/viewtopic.php?p=2269441#2269441 /I am attempting to use the hilo generator where the column is a long. Looking at the TableHiLoGenerator class, it appears to me that the generation goes through a step in which it is converted to an int. The particular method is: TableGenerator.doWorkInCurrentTransaction(Connection conn, String sql) Within this method, we perform the select query to get the next value, then perform the update to increment the counter. However, we extract the select query resultSet with: result = rs.getInt(1); And we update the query with: ups.setInt( 1, result + 1 ); ups.setInt( 2, result ); If I'm not mistaken, those ...Int() methods are bugs. Instead, these get/set methods should be delegated to the IdentifierGeneratorFactory class (which has a get method but would need a set). /