Hi everybody, I have a little Problem with LDMs:
I have a page with a ListView and for each item in the ListView the user can open a modalWindow to edit the item. My Problem is, that I don't want to persist the item to the DB from the modalWindow. Only after the User confirms the changes in the page with the ListView, all these changes for all items from the ListView should be persisted. Or the User presses "abort" and nothing is persisted. When I use LDMs changes that are made in the modalWindow are never shown in the ListView, because the models are detached. I could use normal Models or the actual Objects for this, but then I might run into lazy-initialization-problems. Has anybody a solution for this problem, or is this simply not possible in this way? Thanks in advance, Benjamin ------------------------------------------------------------------- My Code looks like this: ListView<Account> accountListView = new ListView<Account>("accountList", accountList) { @Override protected void populateItem(ListItem<Account> item) { DetachableEntityModel<Account> account = new DetachableEntityModel<Account>(item.getModelObject()); item.add(new Label("accountName", new PropertyModel<String>(account, "name"))); item.add(new Label("accountNumber", new PropertyModel<String>(account, "number"))); item.add(new AjaxLink<Account>("edit", account) { @Override public void onClick(AjaxRequestTarget target) { modalWindow.showPage(target, new AccountEditPage(modalWindow, this.getModel())); } }); } }; cont.add(accountListView); AjaxLink save = new AjaxLink("saveAccounts") { @Override public void onClick(AjaxRequestTarget target) { User user = userModel.getObject(); user.getAccounts().clear(); user.getAccounts().addAll(accountList); ServiceLocator.instance().getUserService().saveUser(user); } };