假设我有以下课程
@Entity
public class Customer extends Model {
@Id
public int id;
public String email;
@ManyToOne
public List<Order> orders;
public HashMap<String, Object> additionalData;
public static Finder<String, Customer> find = new Finder<String, Customer>(String.class, Customer.class);
public static List<Customer> getCustomersWithOpenOrders(){
return find
.fetch("orders")
// with "order.state = 'open'" count > 0
// add total sum of all orders to 'additionalData' collection
.findList();
}
}
如何存储additionalData
集合中所有订单的总和?