Post

JDBC, JPA, Hibernate, Spring Data JPA

JDBC, JPA, Hibernate, Spring Data JPA

Looking at it in terms of layers:

JDBC (Java Database Connectivity): The API (interface) Java provides for accessing a database.
JPA (Java Persistence API): The standard specification for Java ORM technology (interface).
Hibernate: One of the implementations of JPA.
Spring Data JPA: Abstracts JPA implementations one level further, letting you focus more on business logic. However, this makes it harder to write DB-independent code. It uses the Repository interface.


1
2
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'mysql:mysql-connector-java:8.0.28'

When you add the spring-data-jpa dependency,
even if you’re not doing any actual DB work and just want to test JPA implementation code, you still need to specify a dataSource for it to run.

1
2
3
4
spring.datasource.url=jdbc:mysql://192.168.1.4:3306/test
spring.datasource.username=root
spring.datasource.password=1234
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

###

2023.07.14 - [Spring/JPA] - 스프링) Spring Boot의 JPA @Transactional/SimpleJpaRepository (23-07-09)

This post is licensed under CC BY-NC 4.0 by the author.