Patterns In J2EE DAO Pttern
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   narender_reddy
Posted On:   Wednesday, April 5, 2006 10:36 AM




Explain me DataAcessObject Design pateern with implementation clss..

Re: Patterns In J2EE DAO Pttern

Posted By:   Robert_Lybarger  
Posted On:   Sunday, April 9, 2006 10:31 PM

Someone who knows just enough Java and SQL can write an application where, in any place data needs to go to/from the database, they directly write connection code, the SQL statement, etc. They have such stuff spread out all over the app.



Someone who knows about the DAO pattern will probably make a "utility" class that does *ALL* the database-specific code in one spot, and the rest of the application's objects will make calls through an instance of this object. This provides isolation of the tricky DB code that has advantages on team assignments where only one person knows how to effectively deal with JDBC.

Re: Patterns In J2EE DAO Pttern

Posted By:   WarnerJan_Veldhuis  
Posted On:   Wednesday, April 5, 2006 10:54 AM

Use a Data Access Object (DAO) to abstract and encapsulate all access to the data source. The DAO manages the connection with the data source to obtain and store data.



The DAO implements the access mechanism required to work with the data source. The data source could be a persistent store like an RDBMS, an external service like a B2B exchange, a repository like an LDAP database, or a business service accessed via CORBA Internet Inter-ORB Protocol (IIOP) or low-level sockets. The business component that relies on the DAO uses the simpler interface exposed by the DAO for its clients. The DAO completely hides the data source implementation details from its clients. Because the interface exposed by the DAO to clients does not change when the underlying data source implementation changes, this pattern allows the DAO to adapt to different storage schemes without affecting its clients or business components. Essentially, the DAO acts as an adapter between the component and the data source.
About | Sitemap | Contact