From the course: Java Database Access with Hibernate

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Mapping strategies

Mapping strategies - Java Tutorial

From the course: Java Database Access with Hibernate

Start my 1-month free trial

Mapping strategies

- [Instructor] When working with Hibernate, it's important to understand mapping strategies to map the database to your Java objects. Entities and classes, which we're used to using in Java, refer to tables in the database when you're using Hibernate. An instance of a class refers to a row in the table, and the properties of the class refer to the columns in the table. These classes should follow the Plain Old Java Object standard or the JavaBean programming model which includes the setter and getter methods for all the attributes and a default empty constructor. Here is an example of my database table and you can see here the class name is the name of the table, the attributes for my class are represented by columns, the id and the message, and each instance of my class is a row. So for example, this first row has an id number of three and a message of Hello World. Hibernate requires to know in advance where to find the mapping information that defines how your Java classes relate to…

Contents