[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2464) allow SequenceGenerator and TableGenerator to define increment and initial

Steve Ebersole (JIRA) noreply at atlassian.com
Fri Mar 2 12:59:31 EST 2007


allow SequenceGenerator and TableGenerator to define increment and initial 
---------------------------------------------------------------------------

         Key: HHH-2464
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2464
     Project: Hibernate3
        Type: Improvement

  Components: core  
    Reporter: Steve Ebersole
 Assigned to: Steve Ebersole 
     Fix For: 3.2.3


Add two new parameters to SequenceGenerator and TableGenerator as follows:

1) 'initial' - the initial value from which to start generating values.  This one really only has an effect during schema export when creating the underlying structures.  For sequences this would require the sequence to be able to define the "start with" value ala Oracle.  For tables, this would be the value we initially insert into the table on creation.

2) 'increment' - The number by which values in the underlying DB structure are incremented.  The basic idea is to minimize the number of times we need to hit the database in order to generate id values.  Historically, both SequenceGenerator and TableGenerator hit the database each and every time an id value is requested.  However, via this increment, we could essentially create a pool of available id values in memory and use that pool of values as id values.  Only when the pool is exhausted would we need to hit the database.  There are 2 aspects to how this new 'increment' param would affect the implementations:
a) how values would be retrieved from the underlying structure.  For sequences, this would require that the sequences be able to define the increment ('increment by' in Oracle-speak); it would then take care of the rest of the deatils to this aspect.  For tables, we would need to change the way we perform the updates after value retrieval to use the increment rather than the 1.
b) return values from this "pool" on calls to #generate(...) as long as values still exist in the pool; if not rebuild the pool values...

-- 
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