Jakarta Data brings a standardized repository API to the Jakarta ecosystem.
If you already use Spring Data JPA, the model will look familiar: repository interfaces, CRUD operations, derived queries and JPQL annotations.
However, with Spring, the integration is not automatic.
🔸 TLDR
Hibernate 6.6+ can implement Jakarta Data repositories, but Spring does not yet provide native transaction integration for them.
🔸 1. DEFINE THE REPOSITORY
BasicRepository provides common data operations, while Hibernate uses StatelessSession behind the generated repository.
🔸 2. CONNECT IT TO SPRING
Spring does not automatically bind Jakarta Data repositories to its transaction context.
A proxy is therefore required to retrieve the current EntityManager, reuse its JDBC connection and expose the matching StatelessSession.
🔸 3. DEFINE TRANSACTIONS IN THE SERVICE
The service layer continues to define transaction boundaries, while the proxy connects the repository to the active Spring transaction.
🔸 TAKEAWAYS
▪️ Jakarta Data feels familiar to Spring Data JPA users
▪️ Hibernate implements repositories with StatelessSession
▪️ Spring transaction propagation requires a custom bridge
▪️ Jakarta Data is promising for Jakarta EE and Quarkus
▪️ Spring Data JPA remains the simpler choice for most Spring applications
A very interesting integration; but currently more advanced experiment than drop-in replacement.
#JakartaData #JakartaEE #SpringBoot #Spring #Hibernate #Java #JPA #SoftwareArchitecture
https://vladmihalcea.com/jakarta-data-spring-hibernate/
Go further with Java certification:
Java👇
https://bit.ly/javaOCP
Spring👇
https://bit.ly/2v7222
SpringBook👇
https://bit.ly/springtify
JavaBook👇
https://bit.ly/jroadmap