I have entities User
and Test
@Entity
public class User {
private Long id;
private String userName;
}
@Entity
public class
The following method signature will get you want to want:
List 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.