Should Abstract DAO Factory be application specific?

Hello.

I am not expert in DAO.

Should DAO be application specific or not?

I mean: the Abstract DAO Factory has all abstract methods to give DAO Objects. e.g. getCustomerDAO(), getAccountDAO() etc... (Banking application). But, can I clutter up Abstract DAO Factory with such more methods from different application?

e.g. getPatientDAO(), getDoctorReportDAO() etc... (Health application)?

Kindly reply at earliest.

Thanks in advance.

Anup.

[488 byte] By [sun4anupa] at [2007-9-28 17:57:53]
# 1

> I am not expert in DAO. Should DAO be application specific or not?

> I mean: the Abstract DAO Factory has all abstract methods to give

> DAO Objects. e.g. getCustomerDAO(), getAccountDAO() etc...

> (Banking application). But, can I clutter up Abstract DAO Factory

> with such more methods from different application?

> e.g. getPatientDAO(), getDoctorReportDAO() etc...

> (Health application)?

How about using Facade to decouple the your DAO factory.

...

daoFactory.getDAO( "com...dao.general.CustomerDAO" ) ;

daoFactory.getDAO( "com...dao.general.AccountDAO" ) ;

...

daoFactory.getDAO( "com...dao.health.DoctorReportDAO" ) ;

daoFactory.getDAO( "com...dao.health.PatientDAO" ) ;

or even better softcode the DaoFactory by linking each DAO to a class name from a configuration class. i.e. .INI or XML.

AccountDAO = com...dao.general.CustomerDAO

AccountDAO = com...dao.general.AccountDAO

DoctorReportDAO = com...dao.health.DoctorReportDAO

PatientDAO = com...dao.health.PatientDAO

...

daoFactory.getDAO( "CustomerDAO" ) ;

daoFactory.getDAO( "AccountDAO" ) ;

...

daoFactory.getDAO( "DoctorReportDAO" ) ;

daoFactory.getDAO( "PatientDAO" ) ;

class DaoFactory {

getDAO( string key ) {

className = config.getClassName( key ) ;

...

}

MartinS.a at 2007-7-12 15:40:25 > top of Java-index,Other Topics,Patterns & OO Design...