Hi Serdar, I did. And here's the thing ... the framework has always done this (at least since 1.8.0, which was the first version I tested). So, my apologies for indicating otherwise.
Clearly we ought to do better here, and I do have a workaround which you could try out. In your application's DomainApplication (subclass of IsisWicketApplication), add the following to the end of the init() method: getRequestCycleSettings().setRenderStrategy(RequestCycleSettings.RenderStrategy.REDIRECT_TO_BUFFER); By default we use the REDIRECT_TO_RENDER strategy ... I dimly recall my rationale as being that it's "safer"; this Wicket wiki page [1] explains the difference. However, this is what causes the 1+N loading that we see. A first Isis/DN session is used to select the objects, and mementos for all retrieved objects are captured. This first session is then closed. On render, we then open a new Isis/DN session and use those mementos to retrieve all objects one by one. Using REDIRECT_TO_BUFFER means that all the work is done in a single session, avoiding the issue. My limited testing didn't throw up any adverse effects to switching to REDIRECT_TO_BUFFER, and I've raised a ticket [2] to explore changing this behaviour. Thanks for raising this, let me know how you get on. Cheers Dan [1] https://cwiki.apache.org/confluence/display/WICKET/Render+strategies [2] https://issues.apache.org/jira/browse/ISIS-1774 On Sat, 11 Nov 2017 at 20:30 Serdar Hamzaogullari <hasan.ser...@foreks.com> wrote: > Hello Dan, > > Did you have a chance to take look at my github example app > > 9 Kas 2017 Per, saat 16:22 tarihinde Serdar Hamzaogullari < > hasan.ser...@foreks.com> şunu yazdı: > > > Hi Dan, > > > > Here is a complete example of the problem > > > > https://github.com/radresian/apache-isis-sample > > > > After running the application Click the ProfilePreferences Menu -> List > > All, then you will see the SQL queries for each entry at the console > logs... > > > > On Thu, Nov 9, 2017 at 2:17 AM, Dan Haywood < > d...@haywood-associates.co.uk> > > wrote: > > > >> Hmm, looks ok. > >> > >> Can you upload an example app to github so I can pull it down and take a > >> closer look? > >> > >> Thx > >> Dan > >> > >> On Wed, 8 Nov 2017 at 23:12 Serdar Hamzaogullari < > hasan.ser...@foreks.com > >> > > >> wrote: > >> > >> > Hi Jörg, > >> > > >> > IdGeneratorStrategy.IDENTITY did not help. Same result. > >> > > >> > Hi Dan, > >> > > >> > Here is my repository: > >> > > >> > > >> > @DomainService( > >> > nature = NatureOfService.DOMAIN, > >> > repositoryFor = ProfilePreferences.class > >> > ) > >> > public class ProfilePreferencesRepository { > >> > > >> > public List<ProfilePreferences> listAll() { > >> > return > repositoryService.allInstances(ProfilePreferences.class); > >> > } > >> > > >> > public ProfilePreferences get(final String name) { > >> > return repositoryService.uniqueMatch( > >> > new QueryDefault<>( > >> > ProfilePreferences.class, > >> > "get", > >> > "name", name)); > >> > } > >> > > >> > public ProfilePreferences create(final String name) { > >> > final ProfilePreferences object = new > ProfilePreferences(name); > >> > serviceRegistry.injectServicesInto(object); > >> > repositoryService.persist(object); > >> > return object; > >> > } > >> > > >> > @javax.inject.Inject > >> > RepositoryService repositoryService; > >> > @javax.inject.Inject > >> > ServiceRegistry2 serviceRegistry; > >> > } > >> > > >> > > >> > > >> > On Wed, Nov 8, 2017 at 8:16 PM, Dan Haywood < > >> d...@haywood-associates.co.uk> > >> > wrote: > >> > > >> > > Hi Serdar, > >> > > > >> > > can you show us your repository implementation? > >> > > > >> > > I'm wondering why you have defined a query called "Get", I wonder if > >> it's > >> > > being used in that repo (I don't think it should be, if so) > >> > > > >> > > Ta > >> > > Dan > >> > > > >> > > > >> > > On Wed, 8 Nov 2017 at 17:09 Rade, Joerg / Kuehne + Nagel / Ham > GI-DP < > >> > > joerg.r...@kuehne-nagel.com> wrote: > >> > > > >> > > > Hi Serdar, > >> > > > > >> > > > did you consider: > >> > > > > >> > > > @javax.jdo.annotations.DatastoreIdentity( > >> > > > strategy = > >> javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, > >> > > > column = "id") > >> > > > > >> > > > instead of: > >> > > > > >> > > > @PrimaryKey? > >> > > > > >> > > > Best regards > >> > > > Jörg > >> > > > > >> > > > -----Ursprüngliche Nachricht----- > >> > > > Von: Serdar Hamzaogullari [mailto:hasan.ser...@foreks.com] > >> > > > Gesendet: Mittwoch, 8. November 2017 17:07 > >> > > > An: users@isis.apache.org > >> > > > Betreff: Menu getAll action returns table with many sql queries > for > >> > each > >> > > > entry > >> > > > > >> > > > Hi, > >> > > > > >> > > > I have a menu action like this, listAll action: > >> > > > > >> > > > > >> > > > @DomainService( > >> > > > nature = NatureOfService.VIEW_MENU_ONLY, > >> > > > objectType = "profile-preferences-services", > >> > > > repositoryFor = ProfilePreferences.class > >> > > > ) > >> > > > @DomainServiceLayout( > >> > > > named = "Profile Preferences", > >> > > > menuOrder = "3" > >> > > > ) > >> > > > public class ProfilePreferencesMenu { > >> > > > > >> > > > @Action(semantics = SemanticsOf.SAFE) > >> > > > @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT) > >> > > > @MemberOrder(sequence = "1") > >> > > > public List<ProfilePreferences> listAll() { > >> > > > return profilePreferencesRepository.listAll(); > >> > > > } > >> > > > . > >> > > > . > >> > > > . > >> > > > > >> > > > My Entity is that: > >> > > > > >> > > > > >> > > > @javax.jdo.annotations.PersistenceCapable( > >> > > > identityType=IdentityType.APPLICATION, > >> > > > table="profile_preferences", > >> > > > schema = "dbo" > >> > > > ) > >> > > > @javax.jdo.annotations.Version( > >> > > > strategy= VersionStrategy.VERSION_NUMBER, > >> > > > column="version") > >> > > > @javax.jdo.annotations.Queries({ > >> > > > @javax.jdo.annotations.Query( > >> > > > name = "get", > >> > > > value = "SELECT " > >> > > > + "FROM > >> > > > com.foreks.user.settings.domain.preferences.ProfilePreferences " > >> > > > + "WHERE profileName.equals(:name)") > >> > > > }) > >> > > > @DomainObject( > >> > > > objectType = "profile-preferences" > >> > > > ) > >> > > > public class ProfilePreferences implements > >> > > Comparable<ProfilePreferences> { > >> > > > > >> > > > public ProfilePreferences(final String profileName) { > >> > > > setProfileName(profileName); > >> > > > } > >> > > > > >> > > > @javax.jdo.annotations.Column(allowsNull = "false", length= > 150) > >> > > > @PrimaryKey > >> > > > @Getter @Setter > >> > > > @Title(prepend = "Profile Preferences: ") > >> > > > private String profileName; > >> > > > > >> > > > @javax.jdo.annotations.Column(allowsNull = "true", length = > >> 4000) > >> > > > @Property(editing = Editing.ENABLED,hidden = Where.ALL_TABLES) > >> > > > @Getter @Setter > >> > > > private String preferences; > >> > > > > >> > > > //region > delete (action) > >> > > > @Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE) > >> > > > public void delete() { > >> > > > final String title = titleService.titleOf(this); > >> > > > messageService.informUser(String.format("'%s' deleted", > >> > title)); > >> > > > repositoryService.remove(this); > >> > > > } > >> > > > //endregion > >> > > > > >> > > > //region > delete (action) > >> > > > @Action(semantics = SemanticsOf.NON_IDEMPOTENT) > >> > > > public ProfilePreferences copy(@ParameterLayout(named="Profile > >> > > Name") > >> > > > String name) { > >> > > > final ProfilePreferences object = new > >> ProfilePreferences(name); > >> > > > object.setPreferences(preferences); > >> > > > repositoryService.persist(object); > >> > > > return object; > >> > > > } > >> > > > //endregion > >> > > > > >> > > > //region > toString, compareTo > >> > > > @Override > >> > > > public String toString() { > >> > > > return ObjectContracts.toString(this, "profileName"); > >> > > > } > >> > > > > >> > > > @Override > >> > > > public int compareTo(final ProfilePreferences other) { > >> > > > return ObjectContracts.compare(this, other, > "profileName"); > >> > > > } > >> > > > //endregion > >> > > > > >> > > > //region > injected services > >> > > > @javax.inject.Inject > >> > > > RepositoryService repositoryService; > >> > > > > >> > > > @javax.inject.Inject > >> > > > TitleService titleService; > >> > > > > >> > > > @javax.inject.Inject > >> > > > MessageService messageService; > >> > > > //endregion > >> > > > > >> > > > } > >> > > > > >> > > > > >> > > > When I click the List All action from the wicket viewer menu, > server > >> > logs > >> > > > this SQL queries: > >> > > > > >> > > > 19:03:07,334 [Native http-nio-8080-exec-4 DEBUG] > >> SELECT > >> > > > 'com.foreks.user.settings.domain.preferences.ProfilePreferences' > AS > >> > > > NUCLEUS_TYPE,A0.preferences,A0.profileName,A0.version FROM > >> > > > dbo.profile_preferences A0 > >> > > > 19:03:07,436 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'ahl'> > >> > > > 19:03:07,442 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'akbank'> > >> > > > 19:03:07,448 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'bmd'> > >> > > > 19:03:07,454 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'DELTA'> > >> > > > 19:03:07,460 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'foreks'> > >> > > > 19:03:07,466 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'halky'> > >> > > > 19:03:07,472 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'hcbs'> > >> > > > 19:03:07,477 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'issanal'> > >> > > > 19:03:07,483 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'marbas'> > >> > > > 19:03:07,489 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'odeabank'> > >> > > > 19:03:07,495 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'odtu'> > >> > > > 19:03:07,500 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'osmanli'> > >> > > > 19:03:07,506 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'piramit'> > >> > > > 19:03:07,512 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'tebsanal'> > >> > > > 19:03:07,517 [Native http-nio-8080-exec-5 DEBUG] > >> SELECT > >> > > > A0.preferences,A0.version FROM dbo.profile_preferences A0 WHERE > >> > > > A0.profileName = <'ZIRAAT'> > >> > > > > >> > > > > >> > > > There is a query for each entity. The firs query > >> > > > > >> > > > SELECT > >> > 'com.foreks.user.settings.domain.preferences.ProfilePreferences' > >> > > > AS NUCLEUS_TYPE,A0.preferences,A0.profileName,A0.version FROM > >> > > > dbo.profile_preferences A0 > >> > > > > >> > > > should be enough. Query for every entity becomes a performance > >> problem. > >> > > > How can I prevent this behavior ? Is there some thing wrong or > >> missing > >> > in > >> > > > my Entity Class or Menu Action Class ? > >> > > > > >> > > > Help please :) > >> > > > > >> > > > -- > >> > > > <http://www.foreksmobile.com/redirect.html> > >> > > > > >> > > > P > >> > > > > >> > > > Bu mesaji yazdirmadan önce çevreye olan sorumlulugumuzu bir kez > daha > >> > > > düsünelim. > >> > > > Please consider the environment before printing this e-mail. > >> > > > > >> > > > Bu elektronik posta ve onunla iletilen bütün dosyalar sadece > >> > göndericisi > >> > > > tarafından alması amaçlanan yetkili gerçek ya da tüzel kişinin > >> > kullanımı > >> > > > içindir. Eğer söz konusu yetkili alıcı değilseniz bu elektronik > >> > postanın > >> > > > içeriğini açıklamanız, kopyalamanız, yönlendirmeniz ve kullanmanız > >> > > > kesinlikle yasaktır ve bu elektronik postayı derhal silmeniz > >> > > gerekmektedir. > >> > > > FOREKS bu mesajın içerdiği bilgilerin doğruluğu veya eksiksiz > olduğu > >> > > > konusunda herhangi bir garanti vermemektedir. Bu nedenle bu > >> bilgilerin > >> > ne > >> > > > şekilde olursa olsun içeriğinden, iletilmesinden, alınmasından ve > >> > > > saklanmasından sorumlu değildir. Bu mesajdaki görüşler yalnızca > >> > gönderen > >> > > > kişiye aittir ve FOREKS'in görüşlerini yansıtmayabilir. > >> > > > Bu e-posta bilinen bütün bilgisayar virüslerine karşı taranmıştır. > >> > > > * > >> > > > This e-mail and any files transmitted with it are confidential and > >> > > > intended solely for the use of the individual or entity to whom > they > >> > are > >> > > > addressed. > >> > > > If you are not the intended recipient you are hereby notified that > >> any > >> > > > dissemination, forwarding, copying or use of any of the > information > >> is > >> > > > strictly prohibited, and the e-mail should immediately be deleted. > >> > FOREKS > >> > > > makes no warranty as to the accuracy or completeness of any > >> information > >> > > > contained in this message and hereby excludes any liability of any > >> kind > >> > > for > >> > > > the information contained therein or for the information > >> transmission, > >> > > > reception, storage or use of such in any way whatsoever. The > >> opinions > >> > > > expressed in this message belong to sender alone and may not > >> > necessarily > >> > > > reflect the opinions of FOREKS. > >> > > > This e-mail has been scanned for all known computer viruses. > >> > > > > >> > > > Kühne + Nagel (AG & Co.) KG > >> > > > Rechtsform: Kommanditgesellschaft, Bremen HRA 21928, USt-IdNr.: DE > >> > > > 812773878. > >> > > > Geschäftsleitung Kühne + Nagel (AG & Co.) KG: Dr. Hansjörg Rodi > >> (Vors. > >> > ), > >> > > > Martin Brinkmann, Holger Ketz, Jan-Hendrik Köstergarten, Nicholas > >> > Minde, > >> > > > Michael Nebel, Lars Wedel, Matthias Weiner. > >> > > > Persönlich haftende Gesellschafterin: Kühne & Nagel A.G., > >> Rechtsform: > >> > > > Aktiengesellschaft nach luxemburgischem Recht, HR-Nr.: B 18745, > >> > > > Geschäftsführendes Verwaltungsratsmitglied: Karl Gernandt. > >> > > > Geschäftsleitung Region Zentral- und Osteuropa: Dr. Hansjörg Rodi > >> > > (Vors.), > >> > > > Thierry Held, Uwe Hött, Richard Huhn, Holger Ketz, Jan-Hendrik > >> > > > Köstergarten, Jan Kunze, Michael Nebel, Guillaume Sauzedde, > Mustafa > >> > > Sener. > >> > > > > >> > > > Wir arbeiten ausschließlich auf Grundlage der Allgemeinen > Deutschen > >> > > > Spediteurbedingungen 2017 (ADSp 2017). Hinweis: Die ADSp 2017 > >> weichen > >> > in > >> > > > Ziffer 23 hinsichtlich des Haftungshöchstbetrages für Güterschäden > >> (§ > >> > 431 > >> > > > HGB) vom Gesetz ab, indem sie die Haftung bei multimodalen > >> Transporten > >> > > > unter Einschluss einer Seebeförderung und bei unbekanntem > Schadenort > >> > auf > >> > > 2 > >> > > > SZR/kg und im Übrigen die Regelhaftung von 8,33 SZR/kg zusätzlich > >> auf > >> > > 1,25 > >> > > > Millionen Euro je Schadenfall sowie 2,5 Millionen Euro je > >> > > Schadenereignis, > >> > > > mindestens aber 2 SZR/kg, beschränken. Die ADSp sind auf unserer > >> > Webseite > >> > > > als Download erhältlich. Auf Anfrage senden wir Ihnen diese auch > >> gerne > >> > > zu. > >> > > > > >> > > > >> > > >> > -- > >> > <http://www.foreksmobile.com/redirect.html> > >> > > >> > P > >> > > >> > Bu mesaji yazdirmadan önce çevreye olan sorumlulugumuzu bir kez daha > >> > düsünelim. > >> > Please consider the environment before printing this e-mail. > >> > > >> > Bu elektronik posta ve onunla iletilen bütün dosyalar sadece > göndericisi > >> > tarafından alması amaçlanan yetkili gerçek ya da tüzel kişinin > kullanımı > >> > içindir. Eğer söz konusu yetkili alıcı değilseniz bu elektronik > postanın > >> > içeriğini açıklamanız, kopyalamanız, yönlendirmeniz ve kullanmanız > >> > kesinlikle yasaktır ve bu elektronik postayı derhal silmeniz > >> gerekmektedir. > >> > FOREKS bu mesajın içerdiği bilgilerin doğruluğu veya eksiksiz olduğu > >> > konusunda herhangi bir garanti vermemektedir. Bu nedenle bu bilgilerin > >> ne > >> > şekilde olursa olsun içeriğinden, iletilmesinden, alınmasından ve > >> > saklanmasından sorumlu değildir. Bu mesajdaki görüşler yalnızca > gönderen > >> > kişiye aittir ve FOREKS'in görüşlerini yansıtmayabilir. > >> > Bu e-posta bilinen bütün bilgisayar virüslerine karşı taranmıştır. > >> > * > >> > This e-mail and any files transmitted with it are confidential and > >> intended > >> > solely for the use of the individual or entity to whom they are > >> addressed. > >> > If you are not the intended recipient you are hereby notified that any > >> > dissemination, forwarding, copying or use of any of the information is > >> > strictly prohibited, and the e-mail should immediately be deleted. > >> FOREKS > >> > makes > >> > no warranty as to the accuracy or completeness of any information > >> contained > >> > in this message and hereby excludes any liability of any kind for the > >> > information contained therein or for the information transmission, > >> > reception, storage or use of such in any way whatsoever. The opinions > >> > expressed in this message belong to sender alone and may not > necessarily > >> > reflect the opinions of FOREKS. > >> > This e-mail has been scanned for all known computer viruses. > >> > > >> > > > > > > -- > <http://www.foreksmobile.com/redirect.html> > > P > > Bu mesaji yazdirmadan önce çevreye olan sorumlulugumuzu bir kez daha > düsünelim. > Please consider the environment before printing this e-mail. > > Bu elektronik posta ve onunla iletilen bütün dosyalar sadece göndericisi > tarafından alması amaçlanan yetkili gerçek ya da tüzel kişinin kullanımı > içindir. Eğer söz konusu yetkili alıcı değilseniz bu elektronik postanın > içeriğini açıklamanız, kopyalamanız, yönlendirmeniz ve kullanmanız > kesinlikle yasaktır ve bu elektronik postayı derhal silmeniz gerekmektedir. > FOREKS bu mesajın içerdiği bilgilerin doğruluğu veya eksiksiz olduğu > konusunda herhangi bir garanti vermemektedir. Bu nedenle bu bilgilerin ne > şekilde olursa olsun içeriğinden, iletilmesinden, alınmasından ve > saklanmasından sorumlu değildir. Bu mesajdaki görüşler yalnızca gönderen > kişiye aittir ve FOREKS'in görüşlerini yansıtmayabilir. > Bu e-posta bilinen bütün bilgisayar virüslerine karşı taranmıştır. > * > This e-mail and any files transmitted with it are confidential and intended > solely for the use of the individual or entity to whom they are addressed. > If you are not the intended recipient you are hereby notified that any > dissemination, forwarding, copying or use of any of the information is > strictly prohibited, and the e-mail should immediately be deleted. FOREKS > makes > no warranty as to the accuracy or completeness of any information contained > in this message and hereby excludes any liability of any kind for the > information contained therein or for the information transmission, > reception, storage or use of such in any way whatsoever. The opinions > expressed in this message belong to sender alone and may not necessarily > reflect the opinions of FOREKS. > This e-mail has been scanned for all known computer viruses. >