DAO 's factory is right or not! URGENT 2004-07-15 - By Guy Katz
Back there should be no problem to use DAOs like this. just be sure you dont have thread issues in the DAO.
-- --Original Message-- -- From: A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@(protected)]On Behalf Of Manish Malhotra Sent: Thursday, July 15, 2004 10:55 AM To: J2EE-INTEREST@(protected) Subject: DAO's factory is right or not! URGENT
Im again sending this query because no body has replied yet. I need some help as early as possible.
Manish
Hi All,
We have implemented the Data Access Object pattern to access the interact with data base. And to get the different DAO objects we used DAO factory. Code snippet is like this:
public class CentralOverrideDAOFactory { /** Map to store object of different DAO's*/ private static Map daoMap = Collections.synchronizedMap(new HashMap());
/** final constant for bank */ private static final String BANK = "BANK";
/** * This method returns the instance of BankOverrideDAO class from cached map. * If it is not available in map then it creates new instance and returens it. * * @(protected) BankOverrideDAO */ public static BankOverrideDAO getBankOverrideDAO() { BankOverrideDAO bankDAO = (BankOverrideDAO)daoMap.get(BANK); if(bankDAO == null) { bankDAO = new BankOverrideDAO(); daoMap.put(BANK, bankDAO); } return bankDAO; }
}
So, my issue is that we are marinating cache of DAO objects in the factory. And using the same object for multiple request.
Our scenario is like this:
So, please give your suggestions regarding the performance issue.
Thanks in advance.
regards, Manish Malhotra
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
|
|