I am having a few issue in understanding the DAO design pattern Here.
My confusion lies on two points :
entity beans
which are referred to...are they solely for web technologies? I believe I am using the above design pattern with a pure java program, where I use DTO and DAO using generics to represent several types (Contacts, events, jobs, academics). Each have their own implementation of a super-class BASEDAO
, which manages all the sql statements to the database and its connectivity. Now, I am not sure whether my DTOs to represent contact, event, job would be classed as ENTITY BEAN or not. Would my DTO come under the business component the above site speaks of?
Now, Entity Beans are a Java EE concept, you can build DAO without them as well, and many do. (e.g. Hibernate)
To answer your 2nd Q, tight coupling happens when you write your custom code to manage the DB connections, queries and such, without using a DAO. If you use DAO, and use a datasource, all your business logic is safe when you change your data store and or source, which can be handled with minimal change in config script, instead of writing new code all over again in the absence of DAO.