James P.
James P.

Reputation: 19617

How are Data Access Objects usually designed?

How are DAOs usually designed for the typical business application ? Does one class or pattern dialogue with the data source or do you simply have a separate DAO for each Entity ?

Upvotes: 0

Views: 291

Answers (2)

DKSRathore
DKSRathore

Reputation: 3063

In Java Class as DAO

DAO of similar entities should be consolidated in one. The smaller entities are encapsulated as inner classes. However, if the entity is large enough you should have different DAO for each entity.

Upvotes: 0

MattMcKnight
MattMcKnight

Reputation: 8290

I recommend reading Fowler's Patterns of Enterprise Application Architecture. For example, you can use a Table Data Gateway, Row Data Gateway, Active Record, or Data Mapper.

Most projects out there are using an ORM like Hibernate or IBatis, which adapt to the domain model as opposed to using transaction scripts.

Upvotes: 1

Related Questions