Is it proper to use ODMG as a singleton in my web application? I have the following class (brief version) that gets the ODMG Implementation object once, and opens the database once. From then on I simply call OjbDAOFactory.getODMG().

Is this a safe and proper way to do things? If not, what would be a better usage? Thanks.


public class OjbDAOFactory { static Implementation odmg; static Database db; static { try { odmg = OJB.getInstance(); db = odmg.newDatabase(); db.open("default", Database.OPEN_READ_WRITE); } catch (ODMGException ex) { LOGGER.error("", ex); } } public static Implementation getODMG() { return odmg; }


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to