Introduction to @DataJpaTest and Pitfalls of In-Memory Databases For Testing

Опубликовано: 30 Июнь 2026
на канале: Philip Riecks
2,804
53

This is the first video of the @DataJpaTest mini-series. We'll inspect @DataJpaTest for writing tests for our persistence layer and encounter the pitfalls of using an in-memory database (like H2).

Part I:    • Introduction to @DataJpaTest and Pitfalls ...  
Part II:    • Replacing the Default In-Memory Database o...  
Part III:    • Test a Native Query of Your Spring Data JP...  
Part IV:    • Short And Concise Test Setup With @DataJpa...  

Source code: https://github.com/rieckpil/blog-tuto...

Content:

0:00 Which parts of our Spring Data JPA persistence layer should we test?
1:54 Inspecting @DataJpaTest
4:12 Running the first test with @DataJpaTest
5:50 Why H2 is not suitable for our test case
7:45 Add Flyway to the project for creating the database schema on our own

Vlad Mihalcea's hibernate-types project: https://github.com/vladmihalcea/hiber...

More testing related content is available on my blog: https://rieckpil.de/

» For more deep-dive into testing your Spring Boot persistence layer, consider joining the Testing Spring Boot Applications Masterclass: https://rieckpil.de/testing-spring-bo...

» Revamp your Testing Knowledge with this 14 Days Free Email Course on Testing Java Applications: https://rieckpil.de/getting-started-w...

#DataJpaTest #Pitfalls #SpringBoot