The Java EE 6 Tutorial

A Simple Query with Relationships

SELECT DISTINCT p
FROM Player p, IN(p.teams) t