|
Module
|
Artifact ID
|
Description
|
|---|
|
Spring JDBC
|
spring-boot-starter-jdbc
|
- handles the connection to a database
- lets you execute SQL via JdbcTemplate
|
|
Spring Data JDBC
|
spring-boot-starter-data-jdbc
|
- uses entities with additional rules (the class structure needs to follow the aggregate design of DDD)
- basically, we group entities together which have strong coupling and call them aggregates
- the top entity of the aggregate is called the aggregate root
- some other rules:
- an entity can only be part of 1 aggregate
- all relations inside an aggregate need to be unidirectional
- the aggregate root needs to manage to top relation
- entity classes within aggregates can only have one-to-one and/or one-to-many relationships
- because of the rules, every entity within an aggregate can be found starting with the root
- because of the above premise, do not need a repository for each entity like in spring-data-jpa but only for aggregate roots
- following things supported by Spring Data JPA but not Spring Data JDBC
- supports query methods in (v2.0)
- does not support persistence context like Spring Data JPA does
- a big difference between spring-data-jpa and spring-data-jdbc is that no @Entity and no relation annotations (e.g. @OneToMany) need to be used. Spring Data JDBC knows a class is an aggregate root when it contains a repository for that class. And because the rules of the aggregate entities are connected through object references (i.e. one-to-one are object reference, and one-to-many is a collection of objects) Spring Data JDBC also knows what the aggregates are and can transfer data to the database as aggregates.
|
|
Spring Data JPA
|
spring-boot-starter-data-jpa
|
|
|
Spring Data MongoDB
|
spring-boot-starter-data-mongodb
|
|
|
Spring Data Neo4j
|
spring-boot-starter-data-neo4j
|
|
|
Spring Data Elastic Search
|
spring-boot-starter-data-elasticsearch
|
|