# data-jpa-3-to-4 Companion code for **Spring Data JPA 3 to 4 Migration Guide (Spring Boot 3 to 4): What Breaks and How to Fix It** on [ankurm.com](https://ankurm.com/spring-data-jpa-3-to-4-migration-guide/). One source tree, built twice. `common/` holds the application and tests that compile unchanged on both generations; `boot3/` and `boot4/` hold a `pom.xml` each plus the few tests whose code has to differ. The same test writes `output/NN-name-boot3.txt` and `output/NN-name-boot4.txt`, so a before/after is a diff of two files. ## Versions | Component | boot3 | boot4 | |---|---|---| | Spring Boot | 3.5.16 | 4.2.0 | | Spring Framework | 6.2.19 | 7.1.0 | | Spring Data JPA | 3.5.13 | 4.2.0 | | Hibernate ORM | 6.6.53.Final | 7.4.15.Final | | Jakarta Persistence | 3.1.0 | 3.2.0 | | Jackson databind | 2.21.4 | 3.1.8 | | Querydsl (`com.querydsl`) | 5.1.0 | 5.1.0 | | H2 | 2.3.232 | 2.5.252 | | JDK | 25 (Temurin 25.0.5) | 25 | The boot4 tests were also run on Spring Boot 4.0.10 and 4.1.3. Output 15 and 16 were added afterwards and are recorded for 3.5.16 and 4.2.0 only. ## Run it ```bash (cd boot3 && mvn test) (cd boot4 && mvn test) ./scripts/run-all.sh # regenerates every file in output/ PG_URL=jdbc:postgresql://localhost:5432/postgres PG_USER=postgres PG_PASSWORD=... ./scripts/run-all.sh # also output 16 ``` Output 16 needs a real PostgreSQL (captured on 16.15). The tests recreate their tables, so point it at a scratch database. ## What is where | Output | Topic | |---|---| | `01-package-moves` | types that moved or vanished, read from the jars; test slice and Boot package moves | | `02-derived-queries` | Criteria vs JPQL, `NULLS LAST`, non-unique results | | `03-single-result` | `getSingleResult()` and `getSingleResultOrNull()` | | `04-hibernate`, `25-native-temporal-compat` | native query temporal types, `save()` with a hand-assigned id | | `05-specifications-querydsl`, `23-bulk-specification` | Specification null handling, bulk delete and update, Querydsl | | `06`, `15`, `16` keyset | keyset scrolling, including nullable sort columns on H2 and PostgreSQL | | `07-nullness` | `@NonNullApi` vs JSpecify `@NullMarked` | | `08-wiring-and-records` | `EntityManager` beans, a record annotated `@Entity` | | `09`, `11` page JSON | `PageImpl`, `PagedModel`, `Slice`, `Window` | | `10`, `14` Jackson | primitives in request bodies, `spring.jackson.use-jackson2-defaults` | | `12`, `13` projections | DTO projections and when a broken one fails | | `17`, `18` repository API | public method diff, produced by `scripts/ApiDump.java` | | `19-compile-errors` | `broken/boot3-style/*.java` compiled against both classpaths | | `20-metamodel-processor` | `hibernate-jpamodelgen` vs `hibernate-processor` | | `21-querydsl` | record embeddable crash in `com.querydsl` 5.1.0; the OpenFeign fork | | `22-native-parser-property` | where `spring.data.jpa.query.native.parser` lived | | `24-renamed-property` | `spring.dao.exceptiontranslation.enabled` | Boot 3.5 reached the end of open-source support in June 2026; it is here as the "before" side of the comparison.