Insert inverse relationship reference problem
Wara Songkran <[email protected]> Fri, 25 Feb 2005 16:35:46 +0700
| Newsgroups | gmane.comp.python.modeling |
|---|---|
| Message-ID | <[email protected]> |
Hi
I've try to test insertion Ojbect with refference to the others
My Entities are
Entity('Staff',
properties=[ APrimaryKey('id', isClassProperty=0, isRequired=1),
AString('firstName', isRequired=1,
columnName='firstName'),
AString('lastName', isRequired=1, columnName='lastName'),
],
),
Entity('Task',
properties=[ APrimaryKey('id', isClassProperty=0, isRequired=1),
ADateTime('startTime', columnName='startTime',
externalType='datetime'),
ADateTime('completeTime',
columnName='completeTime', externalType='datetime'),
AString('isCompleted',doc='yes or no')
],
),
and my association is
Association('Task', 'Staff',
relations=['staff', 'tasks']),
and when i execute
ec.setAutoInsertion(True)
s = Staff()
t = Task()
s.addToTasks(t)
ec.insert(s)
ec.saveChanges()
the staff foreign key in task row is Null. but if I execute
t.setStaff(s). It's work normally.
do I have to call t.setStaff(s) explicitly
Regards
Wara Songkran
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click