Spring Data: can it find by two values of the same field without writing the implementation?

spring, spring-data, spring-data-jpa

Solution

You can do this with In at the end

findByAgeIn(Collection ages) … where x.age in ?1

http://docs.spring.io/spring-data/jpa/docs/1.6.0.RELEASE/reference/html/jpa.repositories.html#jpa.query-methods

Section 2.3.2 Query creation

In your case it will be

findByFirstNameIn(Collection names)

Problem

I am doing a Spring web app and I use Spring Data. I am able to use Spring Data to find objects by a single value of a field. For example: ``` some_object_repository.findByFirstName("John") ``` Is there any way I can provide two first names (e.g., "John", "David") similar to the following in concept: ``` some_object_repository.findByFirstName({"John", "David"}) ``` without me writing a custom implementation? Regards and thanks!

Original source

Related problems