We will now see how you can fetch specific objects from the database. Note
that once you fetched one or more objects, you do not need to explicitly fetch
the objects in relations, this is done automatically. For example, once you
have fetched a Writer object (see
aWriter.getBooks(), so you do not have
to worry about this. Moreover, these objects in relation to 'aWriter' are only
fetched against the database where they are needed, so the memory footprint of
your application remains reasonable (and the whole database is not fetched
into memory when you access a single object!).
Naturally, before traversing relationships just like you normally do in python code, you need to fetch at least one object. We will see now how this is done.
In this section, we use the model described here: