I wouldn't say it's a bad practice, it just depends on how the objects are 
intended to be used.  If you have mutable data specific to each user that must 
span several pages and shouldn't be messed with by other users than session is 
a good place, like you now have for your DB.  But if there are things that 
should be shared among all users and components then application can be a good 
place for this, better than having singletons.  Example with the app I'm 
working on how is that I put a few factory objects there that determine how 
certain pages, panels, and other components through the application should be 
created for all users.

Craig

-----Original Message-----
From: Randy [mailto:[email protected]]
Sent: Friday, September 18, 2009 9:37 AM
To: [email protected]
Subject: RE: same data set shows for all users


I did not realize the Application instance is not per user.  That clears
things up.

I need the user to have the same data view on several other pages, so
decided to subclasses WebSession and placed the db instance there.  I
suppose this to be a good central location for the individual user.
Everything is working fine now - each user has their own db instance/view
across the several pages of the application.

I got the idea of placing the db instance in the Application class from the
Wicket Examples (org.apache.wicket.examples.repeater.RepeaterApplication).
Is this not a best practice for an enterprise application?


-----Original Message-----
From: McIlwee, Craig [mailto:[email protected]]
Sent: Wednesday, September 16, 2009 20:05
To: [email protected]
Subject: Re: same data set shows for all users

You do realize that there is a single instance of the Application, not one
per user, right?  Your application holds an OrderDatabase and whenever a
user enters a new date range they are altering the contents of the Map in
that OrderDatabase.  So user A sets a date range and fetch is called,
updating the single OrderDatabase.  User B logs in and his OrderDataProvider
pulls items from the same OrderDatabase instance.  You need to have an
instance of this per user in the session instead of a single instance in the
application.  Or better would probably be to put it in the HomePage or
somewhere else.

Craig
Open Roads Consulting, Inc.
757-546-3401
http://www.openroadsconsulting.com
  _____



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to