Hi, I need an advice w.r.t. one of the design approach we are considering.
We are implementing a Java web service provider which acts on data in relational database. Our propose classes are:
- IDAO - interface with execute() method
- GetCustomerDAO and UpdateCustomerDAO implements IDAO
- DAOFactory - List of DAO to be reads configuration file which has a mapping of DAOs to be invoked for a particular service.
- ServiceImpl - contains getCustomer, updateCustomer methods. The service uses DAOFactory to get list of DAO objects and it then iterates over the list and calls DAO.execute method.
I think it's more of like we have converted DAOs in to Command. However, I don't quite like this approach for some reasons: - In ServiceImpl : you can't influence the flow of DAOs being called. For e.g. after execution of 1st DAO if I don't want to execute 2nd DAO but execute 3rd DAO, it's hard to have this implemented. - besides not sure if we can conceptually use DAO. because a Command object can have business logic, however DAOs should only deal with aspects of reading and writing data to db.
Please let me know your views whether the design looks appropriate. thanks