0

I have a multi page form, where end user has to navigate to multiple screens, where each page data has to be persisted in DB. I am looking for caching the query and the results so that they can be reused whenever user tries to navigate to back and forth in the screens. I am trying to enable hibernate second level cache for this and cache the results and query. Is this a good practice. Want to move away from this approach if it is not a recommended. Any suggestions?

user2585494
  • 483
  • 2
  • 7
  • 18
  • It looks like some wizard kind of application, where you capture the details through multiple forms and user can navigate to and fro while entering the data. Once the user completes wizard flow and done with entering the data, what are the chances of he coming back to the same wizard flow to update the data. And to me it looks like a one time activity and once user is done he won't be updating that data too frequently ( I mean not every 10-15 mins or so). Are these fair assumptions? – Madhusudana Reddy Sunnapu Apr 01 '16 at 03:29

1 Answers1

1

Few assumptions I am making regarding the application:

  1. This looks like a wizard kind of gui web app, where user the details through multiple forms and user can navigate to and fro while entering the data.
  2. This data is specific to the user.

Given that, I would prefer to store this data in the HttpSession or Conversation scope (e.g. session scoped action forms or @ConverstaionScoped depending on framework JSF/Struts) etc rather thanhibernate second level cache`.

Reason being,

  1. It is user specific data. Keeping the data that is frequently accessed (hot data) by the application as a whole (not specific to user) in the second level cache results in avoiding the DB round trips and better performance.
  2. Since it is user specific data, HttpSession is better place to store this data, as each user is associated with his own HttpSession object.