Re: Primary Key Generation with MySQL and EOF?

Ashley Aitken <[email protected]> Sat, 03 Apr 2004 00:57:56 +0800
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <BC93BC94.10957%[email protected]>
Hi Chuck,

Latest version of WO 5.2.3

Latest stable release of Connector/J

May I ask why you say it is a bug in the
com.webobjects.jdbcadaptor.MySQLPlugin?

Is that the same as the JDBC driver?

Or is that the plugin that works with EOModeller?

Just curious.

I am also confused how such an obvious thing (primary key generation) could
be a bug when WO is certified for MySQL ;-) :-(

I think it is more likely something I am doing wrong ... as per usual ...
although it isn't a very complex model.

Thanks,
Ashley.


On 3/4/04 12:29 AM, in article
[email protected], "Chuck Hill"
<[email protected]> wrote:

> That sounds like a bug in com.webobjects.jdbcadaptor.MySQLPlugIn
> Which version of WO?
> 
> Chuck
> 
> On Apr 2, 2004, at 8:19 AM, Ashley Aitken wrote:
> 
>> 
>> I think I have tracked down the problem (that was causing the problem
>> with horizontal inheritance).  Primary key's don't seem to be getting
>> set correctly when using the latest MySQL and WebObjects.
>> 
>> EOF creates the eo_pk_table ok and tracks the primary key values ok,
>> but when it writes new records to tables, EOF doesn't seem to write
>> the primary key value.
>> 
>> Hence, all primary key values are set to 0, or at least the first one
>> is, the second attempt to add a new row fails because the primary key
>> is the same.
>> 
>> This is the sort of error I am getting:
>> 
>>  com.webobjects.eoaccess.EOGeneralAdaptorException: EvaluateExpression
>> failed: <com.webobjects.jdbcadaptor.MySQLPlugIn$MySQLExpression:
>> "INSERT INTO sdclient(sdcountry, sdemailaddress, sdstreetaddress,
>> sdfaxnumber, sdphonenumber, sdclientcode, sdpostaladdress, sdname,
>> sdpostcode, sdstate) VALUES (NULL, NULL, ?, NULL, NULL, ?, NULL, ?,
>> NULL, NULL)" withBindings: 1:"B"(streetAddress), 2:"B"(clientCode),
>> 3:"B"(name)>:
>>     Next exception:SQL State:S1009 -- error code: 1062 -- msg: Invalid
>> argument value,  message from server: "Duplicate entry '0' for key 1"
>> 
>> Note, EOF does not seem to be writing the column "sdclientpk" even
>> though it is a part of the model, and it is set at the primary key for
>> that table.
>> 
>> Any ideas, suggestions, obvious errors, most appreciated.
>> 
>> Cheers,
>> Ashley.
>> 
>> _______________________________________________
>> EOF mailing list
>> [email protected]
>> http://www.omnigroup.com/mailman/listinfo/eof