Re: Primary Key Generation with MySQL and EOF?
Re: Primary Key Generation with MySQL and EOF?
- Subject: Re: Primary Key Generation with MySQL and EOF?
- From: Chuck Hill <email@hidden>
- Date: Sun, 3 Jun 2007 09:17:46 -0700
On Apr 2, 2004, at 8:57 AM, Ashley Aitken wrote:
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?
Primary key generation is the responsibility of the plugin. That
said, if you have jdbc2info in the connection dictionary of the
model, and it is for a different database or different version of the
JDBC driver, that could potentially cause this. Then it is kind of a
tossup of whether this is a generic EOF bug or something more
specific to the plugin. Cached jdbc2info is usually more harmful
than helpful, IMO. Mike recently added some code to Wonder to
automatically purge this on app launch (IIRC).
Is that the same as the JDBC driver?
No, it is an extension to EOF that ships with WO. WO ships with
plugins for all the "supported" databases. Vendors (e.g. OpenBase,
FrontBase) supply plugin frameworks to add support for their database.
Or is that the plugin that works with EOModeller?
Just curious.
No, it is mostly concerned with the exact SQL generated for various
operations and for PK generation.
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.
It might the jdbc2info. It might be that the Connector/J version you
are using has some conflict with the plugin. I am not a MySQL user
so I am just guessing here as to the exact cause. You said below
that, "EOF ... tracks the primary key values ok". Does that mean you
can see the correct values if you log them from the Java?
Chuck
On 3/4/04 12:29 AM, in article
email@hidden, "Chuck Hill"
<email@hidden> 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@hidden
http://www.omnigroup.com/mailman/listinfo/eof
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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