Does anyone know how to turn "native" sequencing in DB2? I do get -1 and -2 as values 
for that column and at some point(when application is restarted) it complaints that an 
attempt was made to insert non-unique primary key.

Thanks in advance.
Max.

-----Original Message-----
From: Charles N. Harvey III [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 29, 2004 9:24 AM
To: OJB Users List
Subject: Re: Negative Sequence Numbers?


It means that something isn't set correctly in the database.
This has happened to me many times.  It always happens when I turn on
"native" sequencing (IDENTITY in MSSQL or AUTOINCREMENT in MySql).  Check
the PK of your database, it might not be properly set to increment.  
Whenever
this isn't set properly I get -1 and -2 for sequence numbers all the time.

Although, I might be completely wrong and it might be something totally
different, I thought I'd try though.


Charlie



Vesely, Maxim [IT] said the following on 7/29/2004 9:11 AM:

>I experienced exactly the same problem running in managed environment with JTA 
>transaction.
>
>Max.
>
>-----Original Message-----
>From: Armin Waibel [mailto:[EMAIL PROTECTED]
>Sent: Thursday, July 29, 2004 8:35 AM
>To: OJB Users List
>Subject: Re: Negative Sequence Numbers?
>
>
>Robert Crawford wrote:
>
>  
>
>>Armin Waibel said:
>>
>>    
>>
>>>Robert Crawford wrote:
>>>
>>>
>>>      
>>>
>>>>Armin Waibel said:
>>>>
>>>>
>>>>        
>>>>
>>>>>Do you only use the PB-api? This bug is odmg-api related.
>>>>>          
>>>>>
>>>>I only use the PB-api.
>>>>
>>>>        
>>>>
>>>Then you shouldn't get problems with negative sequence numbers.
>>>Can you describe me with some pseudo code an test case to reproduce your
>>>problem?
>>>      
>>>
>>    
>>
>
>Don't you use transaction demarcation or is this code snip from an 
>managed environment with JTA transaction?
>
>Armin
>
>  
>
>>>From memory, the code looks something like this:
>>
>>PersistenceBroker broker =
>>PersistenceBrokerFactory.createPersistenceBroker(pbKey);
>>User user = new User();
>>user.setEmailAddress(emailAddress);
>>// more setters here, nothing that touches the primary key
>>broker.store(user);
>>
>>At this point the database has a negative number for the primary key and,
>>from what I can recall from my debugging, the user object has zero in the
>>primary key field.
>>
>>Here's the start of the class descriptor:
>>
>><class-descriptor
>>    class="com.kloognome.accesscontrol.ojb.UserInstance"
>>    table="ac_users">
>>    <field-descriptor name="userNbr" column="user_nbr" jdbc-type="INTEGER"
>>primarykey="true" autoincrement="true" access="readonly"/>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>  
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to