Master-detail auto saving

I’ve been working on a business application that is composed of several master-detail entities where a master entity can be related with more than 10 detailed entities. I was wondering if there is any way to save automatically the master entity when any detailed entity is inserted / modified. According to the default behavior of the system, the user is allowed to create a new master entity, then she can insert one or more detailed entities and at the end she should press the button OK for all entities to be saved. What my client requires from the system is the commit operation for master & detailed entities to be automatically called every time a new detailed entity is inserted / modified. Is that possible? If not, could you recommend any workaround?
Ideally, we’d like to have an auto-saving operation for master-detail entities but I am not sure if this could be feasible.

Thank you


You can achieve autosave by adding CollectionChangeListener to the details collection container and invoking commit manually, e.g.

@Subscribe(id = "orderItemsDc", target = Target.DATA_CONTAINER)
public void onOrderItemsDcCollectionChange(CollectionContainer.CollectionChangeEvent<OrderItem> event) {
    if (event.getChangeType() != CollectionChangeType.REFRESH) {

Pay attention to drawbacks of this approach:

  • Extra calls to the DB
  • Changes made before autosave can’t be discarded by clicking the Cancel button



Thank you very much!