Assuming I have two classes that are of this form
class Person {
String name;
List<Organization> orgs;
}
class Organization {
String name;
List<Person> people;
}
What is the best way to store and retrieve this on a database? Is this the best possible design for this kind of relationship?
in a relational database this is usually done using many-to-many relationships which are implemented using foreign keys in an intermediary table. foreign keys imply that the objects (your Person and Organisation) have primary keys (IDs). see for example here: http://en.wikipedia.org/wiki/Many-to-many_(data_model)