to connect to DB with Java/spring.
1. Jdbc client, for low level access with SQL statements.
2. Spring data jdbc, a higher level abstraction on jdbc that auto implements crud methods.
3. Spring data JPA, even higher level abstraction that implements the JPA interface. Typically uses Hibernate ORM.
Additionally, there's JDBC template but that's older and jdbc client is preferred now.
Almost correct. 1 - yes. 2 - yes. 3 - yes. > there's JDBC template but that's older and jdbc client is preferred now That's not correct. Or at least part of it. jdbc client - is the oldest technology, it's from 90-s. Just try to use it or check out examples (I'll google couple of such for you at the end) to see how hard to work with it on a larger scale, when you add more and more tables, and how repetitive that code will be - ~80% of it will be about *mapping* from SQL result into a POJO that represents data of a table. JdbcTemplate - is a technology from spring-data-jdbc (if I'm not mistaken), and is a more convenient version of low level jdbc-client. And it does that tedious mapping for you.
Обсуждают сегодня