The following method signature will get you want to want:
List<Test> findByUsers_UserName(String userName)
This is using the property expression feature of Spring Data JPA. The signature Users_UserName
will be translated to the JPQL x.users.userName
. Note that this will perform an exact match on the given username.
More Related Contents:
- setMaxResults for Spring-Data-JPA annotation?
- Using generics in Spring Data JPA repositories
- What is difference between CrudRepository and JpaRepository interfaces in Spring Data JPA?
- Handling soft-deletes with Spring JPA
- Spring CrudRepository findByInventoryIds(List inventoryIdList) – equivalent to IN clause
- Spring-Data FETCH JOIN with Paging is not working
- Why use returned instance after save() on Spring Data JPA Repository?
- How to use @Transactional with Spring Data?
- Spring Data JPA find by embedded object property
- How to enable LockModeType.PESSIMISTIC_WRITE when looking up entities with Spring Data JPA?
- Spring Data + JPA with multiple datasources but only one set of Repositories
- Dynamic spring data jpa repository query with arbitrary AND clauses
- Spring Boot, Spring Data JPA with multiple DataSources
- How to fetch FetchType.LAZY associations with JPA and Hibernate in a Spring Controller
- Spring-Data-Jpa Repository – Underscore on Entity Column Name
- Filtering database rows with spring-data-jpa and spring-mvc
- Implementing custom methods of Spring Data repository and exposing them through REST
- Spring data jpa- No bean named ‘entityManagerFactory’ is defined; Injection of autowired dependencies failed
- How to manually force a commit in a @Transactional method? [duplicate]
- Use abstract super class as parameter for Spring data repository
- How to map sql native query result into DTO in spring jpa repository?
- Spring-boot: required a bean named ‘entityManagerFactory’ that could not be found
- Difference between save and saveAndFlush in Spring data jpa
- Delete Not Working with JpaRepository
- spring data jpa @query and pageable
- Spring Data JPA: Query by Example?
- java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
- How to store @Query sql in external file for CrudRepository?
- Spring Data – Multi-column searches
- Best way of handling entities inheritance in Spring Data JPA