Flow: JPA + Hibernate + Spring

Controller/Service
   ↓
Repository (Spring Data JPA)          MyBatis Mapper
- auto sql                            - SQL in XML
   ↓                                     ↓
JPA EntityManager (JPA abstraction)     JDBC
   ↓                                     ↓
Hibernate Session                      Database
   ↓
JDBC Connection
   ↓
Database

Setting in application.yml

spring:
	datasource:
		url: jdbc:mysql://localhost:3306/testdb
		username: root
		password: pass
	jpa:
		hibernate:
			ddl-auto: update
		show-sql: true # prints each SQL queries to console
    properties:
      hibernate.format_sql: true   # pretty-print SQL

JPA (Java Persistence API)

Why JPA