Demo: migrating the catalog to Spring Data JPA
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
move products and categories from Spring JDBC to Spring Data JPA; prepares JNR-029-LAB1.
Draft outline details
Step by step
- Keep the
ProductRepositorycontract the service uses; add JPA entities from JNR-028. - Create
ProductJpaRepository extends JpaRepositoryand adapt the existing implementation to call it. - Add
findBySkuand a name search with@Query. - Planned mistake: write a 60-character derived method name; show it, then replace it with
@Query. - Run the API tests; the contract is unchanged.
- Remove the old Spring JDBC code once tests pass.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.