Project Creation

Learn how to create a project for exploring database relationships in Spring.

Project Creation

We will create a project for understanding database relationships by going to Spring Initializr and use the following values for group Id and artifact Id:

  • group id: io.datajek
  • artifact id: database-relationships


For this project, the following dependencies are needed:

  • Spring’s JPA implementation spring-boot-starter-jpa which uses Hibernate ORM framework.
  • spring-boot-starter-web dependency which supports web applications as well as REST services.
  • In-memory H2 database dependency.
  • Spring Boot devtools dependency for auto restart functionality.

Once the project has been imported in the IDE, we will add the Jackson dependency for Hibernate 5 as follows:


This dependency provides support for Hibernate datatypes and specifically handles aspects of lazy-loading.

Database Configuration

Since we have used Spring Boot to create the provide, the datasource has been automatically configured. We will add the data source URL in the file. In addition, we will also enable the web console of the database.

spring.datasource.url = jdbc:h2:mem:testdb
spring.h2.console.enabled = true

We can also enable the show-sql property to displays the SQL queries executed by Hibernate as follows: = true

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.