As a rule, for many, many, you would make two 1-manys. And from the application with interaction documents :
Many-to-Many Relationships We can model many-to-many relationships by storing collections of keys on either side of the relationship. Let us customize our example to let Food keep track of people who consider this to be their favorite:
Person.java import java.util.Set; import com.google.appengine.api.datastore.Key; // ... @Persistent private Set<Key> favoriteFoods; Food.java import java.util.Set; import com.google.appengine.api.datastore.Key; // ... @Persistent private Set<Key> foodFans;
In this example, a Person maintains a set of key values ββthat uniquely identify food items that are favorites, and Food supports a set of key values ββthat uniquely identify Person objects that consider him a favorite. When modeling many-to-many using key values, keep in mind that the responsibility for the content of both parties depends on the responsibility of the application: Album.java
Please note that if the Person instance and the Food instance contained in Person.favoriteFoods are in the same group of individuals, it is not possible to update the person and this favorite food in one transaction. If it is not practical to place objects in the same group of entities, the application must take into account the possibility that the personβs favorite products will be updated without a corresponding update of the product set for fans, or, conversely, that the product set for fans will be updated without an appropriate update for the set of fans of favorite products .
source share