• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Obscure Primary Key Gotcha
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Obscure Primary Key Gotcha


  • Subject: Obscure Primary Key Gotcha
  • From: Paul Lynch <email@hidden>
  • Date: Thu, 19 Oct 2006 20:09:35 +0100

I just came across this, and thought the list might be interested:

I was just working with a legacy database which has a table with a single column, which is of course designated as the primary key. It happens to be a float, represented as a BigDecimal. The (somewhat dubious) logic behind this design isn't important.

If I add a record to the table (EOGenericRecord), with the key field set to a number greater than 1.0, everything is fine. However, if I add a record with a value between 0 and 1.0 (which is the vast majority of the records required), WO silently replaces the value with the next available value from EO_PK_TABLE.

The reason behind this is that EO expects a primary key, when supplied by the user, to be non-null and non-zero. It is obviously (and mistakenly) assuming that values less than 1 are equal to zero - probably because some programmer in the past thought that no one would be dumb enough to use a float as a primary key :-).

Incidentally, the above is what happens using OpenBase; the MySQL driver just generates an exception claiming it is unable to generate a primary key.

Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Obscure Primary Key Gotcha
      • From: Pierre Bernard <email@hidden>
    • Re: Obscure Primary Key Gotcha
      • From: Robert Walker <email@hidden>
  • Prev by Date: Re: Component to display raw row results as table
  • Next by Date: Re: WOComponent for Displaying PDF Problem
  • Previous by thread: Re: stack overflow error
  • Next by thread: Re: Obscure Primary Key Gotcha
  • Index(es):
    • Date
    • Thread