public static void merge(List<Capacity> listToMerge) { for (Capacity cap : listToMerge) { Capacity c = Capacity.find("byWorkplaceAndUser", cap.workplace, cap.user).first(); c.merge(cap); c.save(); } }
public static void deleteAll(String userName) { List<Capacity> caps = Capacity.find("byUser", userName).fetch(); for (Capacity capacity : caps) { capacity.delete(); } }