Morning Chaps,
I'm looking for your thoughts and advice on saving composed objects to the database using the db API. Where do you place your persistence code? For arguments sake let's look at a simple foo/bar example. We have too classes 'foo' and 'bar', and a 'foo' can have many 'bars' within it. How would you handle reading a 'foo' record from the database and saving it back? Making sure that when you read it, you get a list of 'bar' objects inside it, and when saving it saves its relationships and all contained 'bar' objects back to the database? Would you place the queries which save the 'foo' and its 'bars' inside the foo object? Or abstract it out and have 'bar' know how to save itself? If 'bar' does know how to save itself, do we call the save from within 'foo' or abstract that call out to a save_foo() method in a service of something? Having the service loop over the bars and save them? I'm really feeling a little confused about this stuff, saving composed objects to the database is new to me. Thanks guys, Heston
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig