Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF - property get method gets called many times

 
Bert Bertens
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thread is about the JSF caching problem: http://seamframework.org/Documentation/WhyDoesJSFCallMyGetterHundredsOfTimes

I have a <h:dataTable> which calls bean.getList, which creates a query to the database and returns some objects. I obviously don't want this method to be accessed so many times.

I wonder if anyone has a good solution to solve this problem?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't get the list from the database in your bean every time. Get it somewhere else and expose it via the getter, or cache the results the first time the getter is called.

Which is kind of what it says in the link you provided, no? And the comparison of caching techniques linked to on the same page discusses other options in more detail.

What other kind of information are you looking for?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to JSF forum.
 
Bert Bertens
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks! I totally looked over that link, think I'm gonna go with the interceptor way.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic