Discussions

General J2EE: Designing using DAOs

  1. Designing using DAOs (1 messages)

    J2EE Patterns forum J2EE Patterns forum J2EE Patterns forum Messages: 1Messages: 1Messages: 1 Bookmark thread Bookmark thread Bookmark thread Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML
     
    Using DAOs in Design
    Posted by: buddy B on November 16, 2004 @ 02:59 PM
    Hi,
     
        I am designing an application for which I am thinking of designing the Data Access using the DAO Pattern.

         I have a few questions which if anyone could clarify, I would be grateful.

        1. DAOs are used so that the client is loosely coupled with the Persistence layer. So, say at a time, you can have only one type of DB at a time, say Oracle OR Sybase OR Sequel etc. So using Factory Pattern, we can create the corresponding DAO Object on the Fly.

            But, in my case, I have to talk to different types of DBs at a time. I mean, the DB which is solely to my new application will be one, say Oracle, but the application talks to a few other systems whose DB may be different.

            In such a situation, how DAOs can be effectively used? Anybody could help me in this..?

         2. Suppose I have various entities in my application domain , say Customer, Order..say a 10 different items.. So according to DAO pattern, I am going to have 10 different types of DAOs..? Is my understanding correct..?

          Expecting the replies asap...

    Thanks in Advance...

    Best Regards
  2. Designing using DAOs[ Go to top ]

    Buddy,
    DAO's are designed to isolate the logic acessing your DB or a different EAI systems. EAO's, DAO's what ever you can define are just meant to write the programs in a clean manner. We found it very useful when we upgraded our communication framework with OS/390 from CCF to J2C. We have to deal only with the DAO layer. lso every entity having its own DAO's is the way. CustomerDAO, OrderDAO...