I have the followed trouble.
There is an entity Distributor who is connected with the ManyToMany relationship to entity town:
@Entity public class Distri
select distinct distributor from Distributor distributor join distributor.towns town join town.district district where district.name = :name
See: https://en.wikibooks.org/wiki/Java_Persistence/JPQL