|
I would: Assume you have m:n relation between classroom
and students; You would probably have a classroom object
containing a list with students (And a student object containing a list of
classrooms) When persisting the classroom I would (in
a transaction) update the classroom (or insert when classroom_ID==null)
walk through the list of Students and
insert the new students (when student_ID==null) (retrieve the generated ID of the new
Students) remove all (old) related Students out of
the relationship table insert all the related student_ID’s
from the list Don’t know if it’s right, but
it works fine for me J Also tried a way so I didn’t have to
delete and insert the same record; - Add a deleteMe flag to the relationtable When doing the persisting set all the deleteMe
‘sto true for the current classroom Walk through the list of students and
update the flag to false of the relation table If no rows where updated insert a row Delete all rows where deleteMe is true MEINDERT
HOVING From: Rodolfo GarcĂa
Esteban/CYII [mailto:[EMAIL PROTECTED]
-- -- |
