I´m working on a Spring Boot App and struggling on a SQL-Query in my repository. The query should select all IDs from employees which never postet in my Webapp.
In MySQL Workbench following statement ist working propper and I achive the result like expected.
SELECT e.id FROM employees e LEFT JOIN posts p ON p.owner_id = e.id WHERE p.owner_id IS NULL
But I cant find out how to write it in my PostRepository which extends a JpaRepository from Spring. This is the error message
o.h.hql.internal.ast.ErrorCounter : Invalid path: 'p.owner_id
This is the statment I use in my repository.
@Query("SELECT e FROM employees e LEFT JOIN p.posts p ON p.owner_id = e.id WHERE p.owner_id IS NULL")
List<Employee> getEmployeeIdsNeverVoted();
I don´t know how to use the "ON" and define the path for it.