> -----Original Message----- > From: Karr, David [mailto:[EMAIL PROTECTED]] > Sent: Friday, August 23, 2002 5:12 PM > To: [EMAIL PROTECTED] > Subject: Re: Update to question about automatic generation of PK value > in OC4J > > > -----Original Message----- > > From: Karr, David [mailto:[EMAIL PROTECTED]] > > Sent: Friday, August 23, 2002 2:49 PM > > To: [EMAIL PROTECTED] > > Subject: Update to question about automatic generation of > PK value in > > OC4J > > > > While looking for something else in the OC4J documentation, I > > was reminded > > that they do have a supported strategy for automatic > > generation of primary > > key values. When you specify the PK type as "java.lang.Object", the > > container will create the table with a column called "autoid" > > of type LONG. > > The documentation says it uses "random numbers" for the > > primary key value.
Unfortunately, I've discovered this really does nothing, which is not surprising, since I was reading the 9.0.3 version of the manual, but I'm only using 9.0.2 :) . The 9.0.2 manual has nothing about primary key value generation. So, I'm back to the beginning. I did experiment with one idea of managing the value generation entirely inside the database, with a sequence and a trigger, but this doesn't work. The second entity creation fails with a "DuplicateKeyException". I would assume that OC4J is caching the first created entity bean, and does uniqueness validation on the primary key, BEFORE it goes to the database. =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
