Changes to existing Many-to-Many linked entities not reflected in DataGrid after lookup edit

Hi,

I have created a small sample project here with User and Project entities. They have a many-to-many relation with user as owning side.

I’ve inserted a datagrid for the projects in userDetailView with standard list_add, list_edit and list_exclude actions. There are already 2 projects assigned to user “testuser”.

Steps

  • edit ‘testuser’ in userListView
  • click “Add” button on projectsDataGrid (projectListView opens for selecting entities to fill many-to-many relation)
  • select a project that is already assigned to testuser and click “Edit”
  • change name of project and click “ok” (changes will be saved to database immediately. This is also what I want - so I don’t want to set the parent dataContext here)
  • back in projectsListView click “Cancel”

The projectsDataGrid is not updated, although there was a rename of one project entity. The changes will be seen, only on reopening the userDetailView.

In UserDetailView.java on the bottom I’ve tried to update ALL project entities in the addActionAfterCloseHandler, but either the items are not updated or I will get the unsavedChanges dialog (which I also don’t want for a namechange, that is already saved to DB).

But how to update the items, if I don’t know whether the user did change an entry or not, and which entry?

Do you have recommendations on how to handle this?

I have a similar question to entityComboBoxes for that I added Language entity with many-to-one into the same sample project.

Steps:

  • edit ‘testuser’ in userListView (language “en” is already assigned)
  • select entity_lookup from entityComboBox
  • edit name from “en” to “english” and save with “ok”
  • click cancel in languageListView

Also here I have the languageFieldEntityLookupAftercloseHanlder which reloads all entires as we don’t know wheter the user did update or create entities in lookup. So the items in the dropdown are updated but the selected one still shows the old entry with name “en”. Only on reload "english’ is selected correctly.

Is there a better way? I think also for the user it is a little bit confusing seeing the notification about the changes but the field is not updated.

I would appreciate your help on this cases.

Best regards,
Stefanie