Hibernate

Now, let's see how to implement the saveMessage() method using Hibernate. First of all, let's update the pom.xml file to add the following two required dependencies:

<dependencies>  ...  <dependency>    <groupId>org.springframework</groupId>    <artifactId>spring-orm</artifactId>  </dependency>  <dependency>    <groupId>org.hibernate</groupId>    <artifactId>hibernate-core</artifactId>  </dependency></dependencies>

The spring-orm library is Spring's ORM support, based on ORM technologies such as Hibernate. And the hibernate-core library is the Hibernate ORM framework.

Now, let's provide some metadata to Hibernate so that it knows how to map a Message object to the records in the messages table. Here, we will use the JPA annotation to add these metadata ...

Get Building Applications with Spring 5 and Vue.js 2 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.