Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 9: Using Hibernate in Spring > ORM Mapping Using Hibernate Annotations

ORM Mapping Using Hibernate Annotations

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial