Re: Primary Key Generation with MySQL and EOF?

Chuck Hill <[email protected]> Fri, 2 Apr 2004 08:29:35 -0800
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
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