I have persistent class similar to the following:
public class Invoice {
private Map<String, PurchasedItem> itemMap;
}
The PurchasedItem class looks like:
public class PurchasedItem {
private String name;
private int quantity;
}
Let's just say, I have good reasons not to store PurchasedItem objects into their own collection, and I want to store each of them under their respective parent Invoice objects. How do I annotate my classes so that Spring Data MongoDB automatically maps the itemMap correctly to something like:
"itemMap": {
"tomato": {
"name": "tomato",
"quantity": 5
}
}