• Post Reply Bookmark Topic Watch Topic
  • New Topic

Application scope objects

 
Steve Wood
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I have an object which gets loaded A LOT. It's very complex and holds a fair bit of data - i.e. it's a reasonably big job constructing the object every time a user requests a page.

The object could sit in the application scope - though not being a servlet person, I have no idea how you do this...

My question is: I think I can figure out the whole application scope bit, but how do I make sure the object knows when the underlying data (stored in the database) is updated?

So for example, someone changes the data (or deletes it even), how do I tell the application object that's happened?

Any help is much appreciated.

All the best,

Steve
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the database is ONLY accessed via your app, then you could add a "refresh" method to your object and call that method from any methods that update the database.

If the data could be updated via another interface, then it's not so easy.
 
Steve Wood
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben,

That sounds like a reasonable idea - my application is the only one that writes to the database, so I think that would work.

Cheers,

Steve
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!