Spring Data JPA/Boot: findBy ... or
18,349
I added a second parameter to the method and it worked.
List<Transaction> findAllByIdOrParentId(Long id, Long parentId);
This is just a definition for the method because I pass the same parameter to the method from the service as:
List<Transaction> transactions = transactionRepository.findAllByIdOrParentId(transactionId, transactionId);
Author by
biniam
Updated on July 10, 2022Comments
-
biniam almost 2 years
I want to write a finder method in my repository to find an object based on one field OR another one while supplying one parameter like:
@RepositoryDefinition(domainClass = Person.class, idClass = Long.class) public interface PersonRepository extends CrudRepository<Person, Long> { List<Person> findAllByIdOrAnotherId(someId); }
How can I do that without using SQL?