我想将复杂对象保存为另一个对象的属性:
@Entity(noClassnameStored = true)
public class User {
......
@Embedded
public Map<String, List<Order>> orders;
......
}
@Embedded
public class Order {
String productName;
String description;
..........
}
使用setter在代码中设置map:
Map<String, List<Order>> ordersMap = new HashMap<>();
ordersMap.put(...);
user.setOrders(ordersMap);
但在文档&#39; User&#39;每个订单都保存在字段&#39; className&#39;在地图&#39;订单&#39; :
&#34; 1&#34; :[{&#34; className&#34;:&#34; com.domain.Order&#34;, &#34; PRODUCTNAME&#34; :&#34; Milk&#34;, &#34;描述&#34;:&#34; Fresh&#34; } ]
如何不保存字段&#39; className&#39;对于ordersMap内的订单?