Spring Data vs Spring Data JPA vs JdbcTemplate

僤鯓⒐⒋嵵緔 提交于 2021-01-27 11:31:36

问题


I was confident that Spring Data and Spring Data JPA refers as same, but then I watched a tutorial on youtube about Spring Data and he is using JdbcTemplate in that tutorial. So I got confused there.

I want to clarify that what is difference between Spring Data and JdbcTemplate? JdbcTemplate and Spring Data JPA are parts of Spring Data?


回答1:


JdbcTemplate is part of the Spring Framework itself.

Spring Data is the project which consists of multiple sub-projects where Spring Data JPA is one of those sub-projects. Spring Data and the sub projects build on top of the Spring Framework.




回答2:


Use Spring JdbcTemplate if you don't want to access your database schema via a domain model. Using JPA you need to make sure that database schema maps correctly to the domain model.

Performance is almost similar at both spring JdbcTemplate and JPA.

JPA is the Java Persistence API, which is Java's standard API for object-relational mapping.

The Spring Framework consists of a collection of projects, and one of these projects is Spring Data.

The goal of Spring Data is to make it easier to work with different kinds of databases, from traditional relational databases to NoSQL databases. Spring Data supports JPA via the Spring Data JPA subproject.



来源:https://stackoverflow.com/questions/52532319/spring-data-vs-spring-data-jpa-vs-jdbctemplate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!