• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF 2 Handling Data  RSS feed

 
glen quagmire
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm developing an app with JSF2 in Tomcat. Still pretty fresh to JSF I have a question which I guess is pretty simple to answer to someone who's got fairly good experience developing web aps and specifically in JSF 2. It's about the way one should store user's data during their interaction with the application. As it stands right now I am saving a lot of data in a session scoped managed bean (like collection of earlier pulled from database entities which themselves are linked to other entities) and whenever a request is made the application will serve anyone of those objects stored in that collection. But I am worried that the session bean is becoming over bloated and don't know how much memory it is safe for a single session bean to consume. What I don't know is whether when the app goes into production, and a lot of users log in, is then the server gonna be ok to handle it. So I guess my question is as follows.

Is there any rule to go buy about storing, handlind and serving large amounts of users data that comes from the database:

Is it ok to do it my way (that is store a lot of stuff in a session scoped bean) so that with each request the app doesn't nee to query and retrieve the data from database. And it that's the case how to best load entities linked to an object stored in a list so they are not all loaded at once but only after the actual object is used to perform some operations before sending the data to the user.

Or should the app keep session beans fairly light (no lists of pre-pulled enities, objects etc) and instead make a trip to the database every time a larger piece of data is required, retrieve it and serve on the fly?

Or perhaps there's an entirely different method, preferred or recommended, to do this.

All suggestions and help are very much appreciated.
 
Maks Besida
Greenhorn
Posts: 13
Chrome Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Lazy loading for your entities to restrict loading of all entities into the session.
Also read about Cache Managment pattern. It will be useful for solving your problem
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!