Re: Loadable non-detachable list model for listView
Hi, when working with Wicket models, you should always call #getObject() or #getModelObject() as late as possible: ListViewImagesGroup imagesGroupsListView = new ListViewImagesGroup(imagesGroupsListView, imagesGroupsModel) { @Override @Transactional protected void populateItem(final ListItemImagesGroup listItem) { AjaxLinkString deleteImagesGroup = new AjaxLinkString(deleteImagesGroup) { @Override public void onClick(AjaxRequestTarget target) { // access model object as late as possible imagesGroupService.deleteImagesGroup(listItem.getModelObject()); // force reload imagesGroupsModel.detach(); target.add(imagesGroupsForm); } }; listItem.add(deleteImagesGroup); } }; Can you spot the difference? Sven On 02/24/2013 08:12 AM, meduolis wrote: This does not solves the issue. Heres my code: -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216p4656727.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Loadable non-detachable list model for listView
I get same exception with your updates. Looks like I have to reload object from database before it's deletion or delete it by id. Anyway, thanks for help. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216p4656733.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Loadable non-detachable list model for listView
You'll need to apply the OSIV pattern for that. Sven -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216p4656734.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Loadable non-detachable list model for listView
Yes, this is what I wanted. But after I made some investigation how to apply this OSIV filter I found that it could bring more mess then happiness :D; Source: http://stackoverflow.com/questions/1103363/why-is-hibernate-open-session-in-view-considered-a-bad-practice Source how to apply: http://www.jroller.com/cardsharp/entry/open_session_in_view_pattern; Thanks Sven, for help. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216p4656738.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Loadable non-detachable list model for listView
Hi, is there any way to create non-detachable objects model for list view? I want to load actual objects from database for listview items, so I will be able to modify them without reloading. Let say: If I use as my listView model I will not be able to delete them right away like this I will get an exception that object is detached. So if I want to delete it, I need to reload it from DB. Is there any way to load non-detached model object? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Loadable non-detachable list model for listView
You can use a model that is able to load the image object from the database by id: http://wicketinaction.com/2008/09/building-a-smart-entitymodel/ Either you override ListView#getListItemModel() to return such a smart model or you use IDataProvider. Hope this helps Sven On 02/09/2013 02:05 PM, meduolis wrote: Hi, is there any way to create non-detachable objects model for list view? I want to load actual objects from database for listview items, so I will be able to modify them without reloading. Let say: If I use as my listView model I will not be able to delete them right away like this I will get an exception that object is detached. So if I want to delete it, I need to reload it from DB. Is there any way to load non-detached model object? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Loadable-non-detachable-list-model-for-listView-tp4656216.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org