I have entities User and Test
User
Test
@Entity public class User { private Long id; private String userName; } @Entity public class
I was using @JoinTable and I got it working with this :
@Query("select t from Test t join t.users u where u.username = :username") List findAllByUsername(@Param("username") String username);
t.users u instead of User u
t.users u
User u