The Data Tier
Each business-service request is passed to the appropriate business service for processing. A business service performs the necessary business logic and makes use of the appropriate DAO for data-store access. Each DAO performs the necessary interactions with Hibernate in order to act upon a given data store. The UserDAO interface defines the methods each DAO must implement.
The UserDAO Interface
public interface UserDAO
public UserInfo createUser(String id,
public UserInfo readUser(String id)
public UserInfo readUsersByState(String state)
public void updateUser(UserInfo userInfo)
public void deleteUser(UserInfo userInfo)
An implementation of the UserDAO interface enables access to the UserInfo object's data store, and is provided by the HibernateUserDAO
class (see Listing 4
Closing the Gap
The architectural differences between Java object hierarchies and relational database tables make the task of persisting Java object data to and from relational databases quite daunting for developers. The "impedance mismatch" between relational tables and Java object hierarchies has led to the development of several different object-persistence technologies attempting to close the gap between the relational world and the object-oriented world. The Hibernate framework defines an object/relational mapping mechanism and query language that makes storage and retrieval of Java objects to and from a data store a relatively simple proposition.