Spring Data JDBC vs JPA
Spring Data JDBC vs Spring Data JPA: persistence context, dirty checking, lazy loading, aggregates, and when to choose each.
This topic compares Spring Data's two ways of storing objects in a relational database. Both give you repositories, and they disagree about one fundamental thing: whether the objects you load are being watched. JPA tracks every loaded object and saves changes on its own; Spring Data JDBC saves only what you tell it to. It covers the persistence context and dirty checking, lazy loading and the exception it can throw, aggregate roots, and a rule for choosing. It leaves out Hibernate tuning and second-level caches.
Contents
7 cardsnot started