Cosium / spring-data-jpa-entity-graph

Spring Data JPA extension allowing full dynamic usage of EntityGraph on repositories
MIT License
478 stars 49 forks source link

Fix: Added super to calls in repo implementation. #105

Closed ghost closed 1 month ago

ghost commented 1 year ago

I am developing a set of custom spring repos with soft delete logic based on auth context and request params. I wanted to make the system consistent, so just like in your repo I created a custom repo factory bean, custom repo interfaces (overriding all standard JPA repos and EntityGraph repos) and one implementation file with all methods overwritten from the following: CrudRepository, SortingAndPagingRepository, JpaRepository, ByExampleExecutor, JpaSpecificationExecutor + all the methods from EntityGraph versions of repos.

My SoftDeleteRepoImpl FindAll had additional showDeleted boolean param and it called your FindAll method with EntityGraph param in the implementation. The problem I ran into was that my FindAll implementation was calling your FindAll as expected, but your FindAll was calling another signature from my implementation again, which added the soft delete logic twice in an inconsistent way. The fix was to add super to the calls you do under the hood in your repo implementation.

If this is an acceptable change, please accept the PR.

reda-alaoui commented 1 year ago

I don’t entirely understand your usecase. Can you please provide some code snippets to help me understand?