JDBC, JPA, Hibernate, Spring Data JPA
This post was migrated from Tistory. You can find the original here.
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
###
Related Posts
2023.07.14 - [Spring/JPA] - 스프링) Spring Boot의 JPA @Transactional/SimpleJpaRepository (23-07-09)
[스프링) Spring Boot의 JPA @Transactional/SimpleJpaRepository (23-07-09)
2023.07.13 - [spring] - 스프링) JPA persistence/트랜잭션/Entity상태 (23-07-08) 앞의 포스팅에서 jpa를 다루던 것은 hibernate-core이다. implementation ‘org.hibernate:hibernate-core:6.1.7.Final’ 이
cornpip.tistory.com](https://cornpip.tistory.com/30)