[Modeling-users] Insert inverse relationship reference problem
Status: Abandoned
Brought to you by:
sbigaret
|
From: Wara S. <war...@gm...> - 2005-02-25 09:35:49
|
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
|