I am currently working on a struts project using OJB as my persistence layer. My concern is I and am finding I sometimes have quite large objects (notably the current logged in user) stored within the session object. Is there a way I can either monitor or increase the size of this storage space?
I'm not sure if it is down to bad design on my part. The user object for example contains a collection of all the account objects the current logged in user has access to along with a collection of permission objects for each account. A user with access to a lot of account (or worse all of them!) may create a large(ish) object for the session to store. I may have to refactor this into something more efficient with less storage requirement at the cost of more database lookups along the way.
I am worried with a few too many logged in users I may have have out of memory exceptions or similar.
Can anyone who has come up against similar offer any advice?
Thanks, Andrew. [ January 15, 2005: Message edited by: Andrew Edwards ]
If you have "account objects" that are going to be common to all (most) and they could be shared maybe you could store them in the applications scope?
If the objects aren't needed on most pages why carry them in the session? If they're needed of a certain range of pages maybe you could remove them from the session when the user navigates away from this area?
Joined: May 18, 2004
I think storing some common objects in the application layer is a good one. Although I think a lot of my problems stem from initial nuances of the way OJB maps objects and relationships with the database. Although it shouldn't, using it as a persistence layer does seem to guide class implementations and structure slightly. This might be my fault though as this is my first time using OJB.
I think a bit less initially stored within the user object and a couple more real-time database lookups to fill in the gaps at execution time should solve most of my issues.
Thanks for the help,
Andrew. [ January 15, 2005: Message edited by: Andrew Edwards ]