CUBA7 equivilant for datasource updateItem

What is the CUBA7 equivilant to datasource updateItem() ?
I tried the following. The amount total does change in the detail edit table, but its not saved to the database.
In CUBA 6.8 calling updateItem on the datasource would change the screen and save it to the database after clicking save.
The service calculates the amount total for each order detail.

Controller

   @Subscribe
    public void onCalculateTotalBtnClick() {
        Order order = orderService.calculateTotals(getEditedEntity());

        //Does not Work! Amount does changes in screen. Not saved to database
        //Order mergedOrder = dataContext.merge(order);
        //setEntityToEdit(mergedOrder);
        //orderDc.setItem(order);

        //Does not Work either! Amount does changes in screen. Not saved to database
        List<OrderDetail> orderDetails = order.getOrderDetails();
        for (OrderDetail orderDetail : orderDetails) {
            orderDetailsDc.replaceItem(orderDetail);
        }
    }

Service

    @Override
    public Order calculateTotals(Order order){
        for (OrderDetail orderDetail : order.getOrderDetails()) {
            BigDecimal amountTotal = orderDetail.getQty().multiply(orderDetail.getAmount());
            orderDetail.setAmountTotal(amountTotal);
        }
        return order;
    }

Sample project. CUBA 7.02
order7.zip (100.6 KB)

Found a workaround. But its not as convenient as updateItem()

   @Subscribe
    public void onCalculateTotalBtnClick() {
        Order order = orderService.calculateTotals(getEditedEntity());
        List<OrderDetail> orderDetails = order.getOrderDetails();
        for (OrderDetail orderDetail : orderDetails) {
            OrderDetail itemToUpdate = orderDetailsDc.getItem(orderDetail.getId());
            itemToUpdate.setAmountTotal(orderDetail.getAmountTotal());
        }
    }

You are right, the only correct way of update the entity is to update its attributes.

Your case would be much simpler if you don’t send the entity to middle tier for recalculation but did it in a bean of the web tier. Then the bean could update the entity directly and screen would update UI and save modifications without any additional code.