wood burning stoves 2.0*
The moose likes Java in General and the fly likes DAO and Entity class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "DAO and Entity class" Watch "DAO and Entity class" New topic
Author

DAO and Entity class

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Hi,

Can some one explain the difference of each or is it same?

Entity class is the one we generate using JPA by mapping to the relevant table columns and with getter and setters for each data fileds right? eg: Customer table. we call the entity classes as domain classes or persistence classes right?
Then why DAO need for?

Thank You.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

DAO: Data Access Object , the class in which we intract with Database.

Entity Object : Data Transfer Object[DTO] which used to transfer a particular values[properties] from user to Database and viceversa
Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
seetharaman venkatasamy wrote:

Entity Object : Data Transfer Object[DTO] which used to transfer a particular values[properties] from user to Database and viceversa


DTO is something else know. DAO interact with DTO. Am I correct Seetharaman? only DAO communicate with database right?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Harshana Dias wrote:DAO interact with DTO. Am I correct Seetharaman? only DAO communicate with database right?


[Sorry for the late reply] Correct . Entity Carries values to the DAO and DAO to View Layer
Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DAO and Entity class