1 Reply Latest reply on Dec 13, 2002 12:43 PM by juha

    Keeping an object alive?

    Martin Lopez Newbie


      I'm new to J2EE and I have to say, it's overwhelming at first. I'm writing an app that I have a need to retrieve some properties from the database (things such as logging path, path to files on the server, etc) inside different objects. Now, I could just do an SQL call for each property I need but that would be rather ugly. So I thought the correct solution might be to write an object that can be an interface to those properties in the database. I'd like this to be a class that is has two public static methods so I don't have to create a new copy of the object each time I want to retrieve information from it (which would cause me to need to write a singleton anyways).

      Ok, on to the point. I want this object to stay "instantiated" in JBoss at runtime (maybe it stays active after the first time it or one of it's static methods is called) so it doesn't have to keep pulling the info from the database each time.

      Any suggestions on how to do this?