Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Having the configurations in place, the next step is to model the Java POJO entity classes and their mapping to the underlying relational data structure.
There are two approaches to the mapping. The first one is to design the object model first and then generate the DB scripts based on the object model. For example, for the session factory configuration, you can pass in the Hibernate property hibernate.hbm2ddl.auto to have Hibernate automatically export the schema DDL to the database. The second approach is to start with the data model first and then model the POJOs with the desired mappings. We prefer the latter approach, because we can have more control on the data model, which is very useful in optimizing the performance of data access. Based on the data model, Figure 9-5 shows the corresponding OO model with a class diagram.