You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Guido Beutler <gu...@hrs.de> on 2004/12/15 16:09:25 UTC

Are sequence values incremented before use

Hi,

I've got a strange problem when using sequences wir OJB 1.0.0.
In some cases different applications get the same PK value but both are 
using the
same sequence. Does OJB increment the sequence value before use?
I configured the sequence at ojb as followed :

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

Is this correct? Thanks in advance.

best regards,

Guido

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


Re: Are sequence values incremented before use

Posted by Armin Waibel <ar...@apache.org>.
Hi Guido,

Guido Beutler wrote:
> Hi,
> 
> I've got a strange problem when using sequences wir OJB 1.0.0.
> In some cases different applications get the same PK value but both are 
> using the
> same sequence. Does OJB increment the sequence value before use?
> I configured the sequence at ojb as followed :
> 
>   <sequence-manager 
> className="org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl">
>     <attribute attribute-name="autoNaming" attribute-value="true"/>
>  </sequence-manager>
> 
> Is this correct? Thanks in advance.

hmm, if you use this SequenceManager OJB never increment the sequence 
value by "itself" only by calling nextval from database.

I think between 1.0 and 1.0.1 I commented out an part in 
SequenceManagerNextValImpl#createSequence which automatic drop sequences 
under specific circumstances.

If the different applications use the same sequence-name then the 
problem shouldn't caused by OJB (except the issue above), because OJB 
increment PK values only by calling nextval on DB.


regards,
Armin

> 
> best regards,
> 
> Guido
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

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