I hope this isn't too dumb a question, and this looks like the best forum to post it in, even though everone's talking about Hibernate etc...
I have a series of Relational tables as follows:
Person, Accident, Visit, and various Treatment tables.
A person may have multiple accidents, each of which may be associated with multiple Visits, each of which may have several different associated Treatments.
I've associated a simple POJO with each table, and I have a DAOFactory which can produce DAOs for each type of object. I've tried to keep the DAO's cohesive - so each only knows about it's associated POJO.
Now I'm really not sure how best to relate the objects to each other. should a Person contain a List of Accidents? Should the PersonDAO invoke the AccidentDAO to load them? Should I be trying to load a whole object graph from the database when I load a patient? I'm sure I'm missing something because it doesn't feel quite right.