db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron Jones <cameronjon...@yahoo.co.uk>
Subject mysql, innodb & foreign keys...
Date Sat, 31 May 2003 12:57:23 GMT
hi,

i'm having some trouble with torque using mysql and
innodb tables. i'm trying to add entries to a table
with a multiple column primary key. as it's primary
key it has one column which is a integer foriegn key
and the other is a date.

my problem is that when i try to save the object i'm
thrown an SQLException: Cannot add a child row: a
foreign key constraint fails. i've tried removing the
foreign key constraints on the integer column, but
keeing the reference in the schema and object classes,
but then i'm thrown a ClassCastException on saving
when it try's to assign the primary key on the
doInsert- it wants a SimpleKey, but finds a NumberKey.


it all works fine if i add a primary key column in the
table, but it's unnecessary and i'd like to avoid it.

on a smaller note, i generate my schema using the jdbc
function, but ont doing this it generates blank
defaults for all my values. this results in the
BaseObjects being created with variable declerations
like :

int employeeID = ;

or, worse, date columns end up as unenclosed strings:

Date dateStarted = new Date(00-00-00 : 00000);

it's no big problem cause i just go through the schema
deleting the defaults, but it gets a bit annoying.

any help would be most appreciated.
thanks
cameron


__________________________________________________
Yahoo! Plus - For a better Internet experience
http://uk.promotions.yahoo.com/yplus/yoffer.html

Mime
View raw message