CHAPTER 5An Overview of Mapping
The purpose of Hibernate is to allow you to treat your database as if it stores Java objects. However, databases in practice do not store objects—they store data in tables and columns. Unfortunately, there is no simple way to correlate the data stored in a database with the data represented by Java objects.
The difference between an object-oriented association and a relational one is fundamental. Consider a simple class to represent a user, and another to represent an e-mail address, as shown in Figure 5-1.
Figure 5-1. An object-oriented association
User
objects contain fields referring to Email
objects. The ...
Get Beginning Hibernate: From Novice to Professional now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.