It's not using a database sequence; Mark is testing the
SequenceManagerHighLowImpl (see other mail messages), which does not use db
based sequences.

Moreover, MS Sql does not support native datbase sequences - and, as Mark
mentions, he is using MS SQL.

Cheers,

Charles.

> -----Original Message-----
> From: Andy Czerwonka [mailto:[EMAIL PROTECTED]
> Sent: 03 November 2003 14:57
> To: OJB Users List
> Subject: Re: Allocation of auto incremented primary keys 
> between 2 JVMs
> 
> 
> OUCH!! If this doesn't work, the it's a MAJOR problem.  Has someone
> verified in using the PB API in a multi-system environment?  
> Given that
> it's using a database sequence, it shouldn't be a problem.  
> It's got to
> be a bug.
> 
> On Mon, 2003-11-03 at 04:37, Mark Rowell wrote:
> > Hi
> > 
> > Further to my mails last week re auto incremented primary 
> keys (integers)
> > across extents I have created a very simple (non Junit 
> based) test that
> > starts 2 JVMs that write A number of instances of a 
> concrete class into a
> > table using the PerssitenceBroker API.
> > 
> > As it is currently setup, 2 JVMs are started that each 
> attempt to insert
> > 1000 instances. Everytime I have run it (10+) I get less 
> than 2000 rows in
> > the database or I will get a parimary key violation As one 
> JVM attempts to
> > store and ID that has already been created by the other JVM.
> > 
> > I was under the impression that the default highLow 
> sequence implementation
> > would work across JVMs for allocating IDs? 
> > 
> > The attached zip file has everything in it. If one of the 
> OJB developers
> > could take a look at it I would appreciate it.
> > 
> > Here is the stack trace:
> > 
> > com.jnetdirect.jsql.v: Violation of PRIMARY KEY constraint
> > 'PK__Test__72F0F4D3'.  Cannot insert duplicate key in object 'Test'.
> >         at com.jnetdirect.jsql.v.a(Unknown Source)
> >         at com.jnetdirect.jsql.at.a(Unknown Source)
> >         at com.jnetdirect.jsql.af.i(Unknown Source)
> >         at com.jnetdirect.jsql.af.new(Unknown Source)
> >         at com.jnetdirect.jsql.af.int(Unknown Source)
> >         at com.jnetdirect.jsql.ao.executeUpdate(Unknown Source)
> >         at
> > 
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknow
> > n Source)
> >         at
> > 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown So
> > urce)
> >         at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source
> > )
> >         at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source
> > )
> >         at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >         at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >         at Test.main(Test.java:44)
> > rethrown as 
> org.apache.ojb.broker.PersistenceBrokerSQLException: Violation
> > of PR IMARY KEY constraint 'PK__Test__72F0F4D3'. Cannot 
> insert duplicate key
> > in object  'Test'.
> >         at
> > 
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(Unknow
> > n Source)
> >         at
> > 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.storeToDb(Unknown So
> > urce)
> >         at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source
> > )
> >         at 
> org.apache.ojb.broker.core.PersistenceBrokerImpl.store(Unknown
> > Source
> > )
> >         at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >         at
> > org.apache.ojb.broker.core.DelegatingPersistenceBroker.store(Unknown
> > Source)
> >         at Test.main(Test.java:44)
> > Caused by: com.jnetdirect.jsql.v: Violation of PRIMARY KEY 
> constraint
> > 'PK__Test_ _72F0F4D3'. Cannot insert duplicate key in object 'Test'.
> >         at com.jnetdirect.jsql.v.a(Unknown Source)
> >         at com.jnetdirect.jsql.at.a(Unknown Source)
> >         at com.jnetdirect.jsql.af.i(Unknown Source)
> >         at com.jnetdirect.jsql.af.new(Unknown Source)
> >         at com.jnetdirect.jsql.af.int(Unknown Source)
> >         at com.jnetdirect.jsql.ao.executeUpdate(Unknown Source)
> >         ... 7 more
> > 
> > 
> > I am using RC4. This test has no caching. The RDBMS is 
> SQLServer2000.
> > 
> > To run the test extract the zip file to some directory. Go into that
> > directory and create a lib sub-dir.
> > Copy the RC4 jar all the commons jars (and the Jar that 
> contains the logging
> > code -- in my case log4j)
> > 
> > You will need a batch file called JDK14.BAT somewhere on 
> you path that sets
> > the path to point to the JDK.
> > The batch file run.bat starts 2 JVMs that write the info 
> into the database.
> > 
> > Regards
> > 
> > Mark Rowell
> > 
> > -------------------------------------------
> > Mark Rowell
> > Structured Credit Europe
> > CreditTrade Limited
> > 180 Fleet Street
> > London EC4A 2HG
> > 
> > Tel +44 (0)20 7400 5078
> > Fax +44 (0)20 7400 5099
> > 
> > http://www.credittrade.com
> > 
> >  
> > 
> > 
> > 
> > CreditTrade Limited is regulated by the FSA. (c) 
> CreditTrade 2002. All rights reserved. The information and 
> data contained in this email is provided for the information 
> purposes of the addressee only and should not be reproduced 
> and/or distributed to any other person. It is provided 
> without any warranty whatsoever and unless stated otherwise 
> consists purely of indicative market prices and other information.
> > 
> > Any opinion or comments expressed or assumption made in 
> association with the data or information provided in this 
> email is a reflection of CreditTrades judgement at the time 
> of compiling the data and is subject to change. CreditTrade 
> hereby makes no representation and accepts no responsibility 
> or liability as to the completeness or accuracy of this email.
> > 
> > The content of this email is not intended as an offer or 
> solicitation for, or recommendation of, the purchase or sale 
> of any financial instrument, or as an official confirmation 
> of any transaction, and should not be construed as investment advice.
> > 
> > 
> ______________________________________________________________________
> > 
> > 
> ---------------------------------------------------------------------
> > 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]
> 
> 


This email and any attachments are strictly confidential and are intended
solely for the addressee. If you are not the intended recipient you must
not disclose, forward, copy or take any action in reliance on this message
or its attachments. If you have received this email in error please notify
the sender as soon as possible and delete it from your computer systems.
Any views or opinions presented are solely those of the author and do not
necessarily reflect those of HPD Software Limited or its affiliates.

 At present the integrity of email across the internet cannot be guaranteed
and messages sent via this medium are potentially at risk.  All liability
is excluded to the extent permitted by law for any claims arising as a re-
sult of the use of this medium to transmit information by or to 
HPD Software Limited or its affiliates.



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

Reply via email to