Forums Register Login

JSF 2 Handling Data

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
I don't like that guy. The tiny ad agrees with me.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 904 times.
Similar Threads
Passed SCBCD 5.0 :)
MVC Model and Domain Model
Context mapping between backing/managed beans
How to handle request params and navigation
Creating managed bean with different parametrs
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:39:34.