Paul,

Interesting, but unexpected behavior is exactly what I would expect in this situation.  EOF expects one of a couple different data types for use as primary keys.  Any type of float value (including BigDecimal) is not one of them.  Basically either a unary integer PK or a specific binary format is what EOF can deal with.  Anything else requires some form of custom PK generation scheme.

On Oct 19, 2006, at 3:09 PM, Paul Lynch wrote:

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 protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

--
Robert Walker



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to