Join tables in MySQL
"jbs_mailuk" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.newbies |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have a problem with the standard join tables created by EOModeler,
while accessing a MySQL database.
I need to be create a row in the join table by choosing the two PKs,
or at least the related entities they represent. Hence the PKs are
used as FKs as well. Shouldn't be a problem as long as the combo is
unique, right?
Alas, there is indeed a problem. Creating a new join table entity (in
this case a type called TermCon) with its PKs chosen by choosing two
related objects (equivalent to myTermCon.setEntity1(myEntity1) &
myTermCon.setEntity2(myEntity2)), a ec.insertObject(myTermCon) call
followed by an ec.saveChanges() results in the following error:
***********************************************
java.lang.IllegalStateException: Adaptor
com.webobjects.jdbcadaptor.JDBCAdaptor@1d3cdaa failed to provide new
primary keys for entity 'TermCon'
***********************************************
It seems that MySQL won't let me choose my own PKs via related entites
- it wants to choose them itself via the eo_pk_table method. Hence I
could create a new row as long as I don't care what the PKs are, i.e.
they aren't used as selectable FKs, which defeats the whole purpose of
a join table.
So how do I create a row in a join table in MySQL? Is there some way
of turnng off the eo_pk_table functionality on join tables only?
Any ideas?
TIA,
John
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/webobjects-newbies/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/