Discussions

General J2EE: Thought about DAO

  1. Thought about DAO (2 messages)

    I read an article on java.sun.com about the DAO Pattern. I don't really feel comfortable with this method as it keeps me from adding new DAOs dynamically and add new Factory's for each type of Database. Im not very familiar with J2EE but this came to mind.

    Wouldn't it be better to have this control centralized. Give each DAO a specific name and ask for it like a lookup. Have an administrator tool connect the DAO name to a specific DAO implementation. In this way you can change implementation whenever you want without touching the application logic or the factory itself. All the application logic need to know is its specific interface.

    You could take this one step further and have the administrator tool connect the name with a Factory instead of a DAO Implementation. In this way you could easily change it from DAO to for example an EJB.

    Threaded Messages (2)

  2. Thought about DAO[ Go to top ]

    Look in the Patterns section at Value Object Dispatcher. This pattern does pretty much exactly what you are trying to describe here. I have implemented it in a couple of systems, and it works very well.

    http://www.theserverside.com/patterns/thread.jsp?thread_id=19020&article_count=12
  3. DAO resources[ Go to top ]

    http://jinx.swiki.net/282