My tutor told me there is difference between DAO and hibernate...i Have been searching for the answer since yesterday, but couldn't find it. Can anyone explain it clearly please.
DAO (Data Access Object) is a design pattern which defines a way to hide the persistence layer of your application. The classes using its interface will be unaware of the persistence operations and, uncoupled from the database or any other persistece mechanisms you use.
Hibernate is a ORM (object-relational mapping) library, which enable you to map your Java classes to relational tables. Using Hibernate, you can save and query your data from tables without writing SQL queries by hand.
So even if you use Hibernate, you still may want to implement DAO pattern to decouple the persistence layer from your application.
its like the difference between the concept of transport and a diesel engine
DAO is a pattern where you isolate persistence related operations from the rest of your application. its a way to design a data handling component
Hibernate is a specific implementation of an ORM framework. its a tool used to make your DAO implementation simpler (most of the times :P)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With