Exercise 10: JPQL - jkneal/spring-angular-train GitHub Wiki

Goals

Our store API has a few methods which we have not implemented yet and we will now implement the first: finding all stores. We will use JPQL and a named query to implement this method.

Instructions

  1. Review the new tests in the StoreRepositoryTest class. Execute them to make sure the new tests still fail.

  2. Implement the findAll method in the JpaStoreRepository. Use JPQL to create a new query which will return all stores in the database.

  3. Run the tests again to verify that the testFindAll test now passes

  4. Now that you have created the query directly in your repository convert it into a named query on our Store class

  5. Refactor the findAll method in the JpaStoreRepository class to use the new named query

  6. Run the tests again to verify that the testFindAll test still passes

Verification

  1. The test cases will pass when the exercise is complete