Running a JPA query to find the 'unlinked' entities in a many to many relationship generates invalid SQL statements.
select p from Policy p where :role not in (p.roles) order by p.name
In attachment a maven project showing the issue we have.