This PR refactor the OwnerRepository, implementing with JpaRepository instead of Repository interface. Remove the rest @Query in OwnerRepository class. Also refactor code logic in test and controller files.
Problem:
Use JpaRepository can auto-generate query, so need to delete the annotations and also rename the method name, rebuild the code logic.
Solution:
Replace: use JpaRepository to replace Repository in OwnerRepository class.
Rename: rename method findByLastName into findByLastNameStartingWith which can be auto-generate.
Remove: remove useless annotations.
Refactor: refactor test and controller code logic.
Type of Change
[X] New feature
[X] Refactor (code restructuring)
[X] Rename(rename method)
[X] Add validate annotation
Changes:
Remove query annotations.
Refactor the method related code structure.
Local Test ScreenShot:
Additional Information:
This is just a part task to refactor the OwnerRepository with JpaRepository. Also need to do the same thing with VetRepository, but next step is to write more unit tests in PetControllerTests.
Title:
Refactor to use JpaRepository default implement
Description:
This PR refactor the
OwnerRepository
, implementing withJpaRepository
instead ofRepository
interface. Remove the rest@Query
inOwnerRepository
class. Also refactor code logic intest
andcontroller
files.Problem:
Use
JpaRepository
can auto-generate query, so need to delete theannotations
and also rename the method name, rebuild the code logic.Solution:
JpaRepository
to replaceRepository
inOwnerRepository
class.findByLastName
intofindByLastNameStartingWith
which can be auto-generate.Type of Change
Changes:
Local Test ScreenShot:
Additional Information:
This is just a part task to refactor the
OwnerRepository
withJpaRepository
. Also need to do the same thing withVetRepository
, but next step is to write more unit tests inPetControllerTests
.