Difference between a HibernateMapping class, DAO class and Model class

blaze_wk used Ask the Experts™
Hi people,

What's the difference between a Hibernate mapping class, DAO class and a Model class?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Where did you get those terms?  I don't think mapping is a class, unless you're talking about the actual implementation of Hibernate...


Yes I'm talking about the actual implementation of Hibernate. And in there I understand that we have to modify some XML files, and also create a class that would have the gettters and setters. I understand there's more to it as well.
The actual implementation of the mapping class can be found in the package org.hibernate.mapping [1].  For the actual XML configuration, see the reference manual [2].

Hibernate does not provide any DAO classes/model classes, that would be implemented by the user.  Again, see the reference manual on how to make your DAOs [3] and models [4].

[1] http://www.hibernate.org/hib_docs/v3/api/org/hibernate/mapping/package-summary.html
[2] http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html
[3] http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html
[4] http://www.hibernate.org/hib_docs/v3/reference/en/html/persistent-classes.html
Nguyen Huu PhuocSenior Manager
To me, their difference is about idea:
+Hibernate: Try to save the java object into relational database instead of object database.
+DAO, Model: Try to make accessing to data independent on data storage mechanism.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial