mardi 30 juin 2020

NoSuchMethodException when using reflection with Spring JPARespository Methods (eg: findByName)

I'm trying implement multiple filters with JPA Query Methods offered by Spring Data JPA.

Dynamic filter eg: findByNameContainingCreatedAtBefore

(eg: findByName) and I used Java Reflection to get a method from JPA Repository and invoke dynamically.

Method method = institutionRepository.getClass().getMethod("findByName", String.class);

But the above line throws NoSuchMethodException.

Are there any ways to fix above issue?





Aucun commentaire:

Enregistrer un commentaire