JDBC와 JPA의 차이점
ㅤ | JDBC | JPA |
Database Interactions | 직접적으로 sql 문을 사용해서 데이터 조작이 가능함 | Java class와 DB table 사이의 매핑을 통해서 데이터 조작을 함 ⇒ 매 쿼리마다 매핑을 하는 것이 time-consuming, error-prone할 수 있음 |
Database Dependency | database dependent(쿼리문을 일일히 작성하기에) | database independent |
Exception Handling | throw checked exception ⇒ must write try catch block | throw unchecked exception(like hibernate) ⇒ no need to try catch |
Performance | 성능은 주요 쟁점 x. 전문적인 개발자라면 뭘 사용하든 잘 할 수 있음 | ㅤ |
Transaction Management | handled explicitly by using commit and rollback | transaction management is implicitly provided in JPA(@Transaction) |
Spring Data(JPA, JDBC..)
Spring Framework — Data Access — 5. ORM Data Access[ Spring Boot Docs ]How-to-guides — data access [ Spring Boot Docs ] Database Initialization