db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Laforge (JIRA)" <j...@apache.org>
Subject [jira] Created: (OJB-66) Allow to specify a sequence start element for SequenceManagerNextValImpl
Date Wed, 10 Aug 2005 08:40:46 GMT
Allow to specify a sequence start element for SequenceManagerNextValImpl
------------------------------------------------------------------------

         Key: OJB-66
         URL: http://issues.apache.org/jira/browse/OJB-66
     Project: OJB
        Type: Improvement
  Components: PB-API, RDBMS platform-specific support  
    Versions: 1.0.3    
 Environment: Oracle 9i
OJB 1.0.3
JDK 1.4.2
    Reporter: Guillaume Laforge


SequenceManagerNextValImpl doesn't support the globalSequenceStart attribute.
Thus all sequences start at 1, even though we may have inserted some sample data already.
Not being able to start at >1 means we'll have errors when inserting new elements when
sample data was already inserted.

I'd like to be able to write:

<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
   <attribute attribute-name="autoNaming" attribute-value="true"/>
   <attribute attribute-name="globalSequenceStart" attribute-value="1000"/>
</sequence-manager>

I also noticed that the PlatformOracleImpl can only create "simple" sequences, though it'd
be great if this (and other platforms) support a method which could be used to specify the
sequence start.

So that'd be great if there could be another method than:
    public String createSequenceQuery(String sequenceName)

For instance:
    public String createSequenceQuery(String sequenceName, int sequenceStart)

On Oracle 9i, we can create a sequence like:
CREATE SEQUENCE FOOBAR_SEQ;

That's what currently supported by the standard createSequenceQuery method, but it's also
possible to create a more complex sequence with:
CREATE SEQUENCE FOOBAR_SEQ START WITH 41 MAXVALUE 999999999999999999999999999 MINVALUE 1 NOCYCLE
CACHE 20 NOORDER;

Or more simply:
CREATE SEQUENCE FOOBAR_SEQ START WITH 41

It may be interesting to be able to specify the other parameters as well, and we could probably
reuse them when defining the sequence manager, with something like:

<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
   <attribute attribute-name="autoNaming" attribute-value="true"/>
   <attribute attribute-name="globalSequenceStart" attribute-value="1000"/>
   <attribute attribute-name="minValue" attribute-value="1000"/>
   <attribute attribute-name="maxValue" attribute-value="1000"/>
   <attribute attribute-name="noCycle"/>
   <attribute attribute-name="cache" attribute-value="20"/>
   <attribute attribute-name="noOrder"/>
</sequence-manager>

(cache 20 pre-computes 20 sequence ids and puts them in a cache, without requiring a new select)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message