In the Sun EJB-QLl documentation I can see that convinients queries like this one can be performed:
SELECT DISTINCT p
FROM Player p, IN (p.teams) t
WHERE t.league = :league
Data retrieved: The players that belong to the specified league.
(( here:
http://java.sun.com/javaee/5/docs/tutor ... bnbtl.html ))
That's great. A very cozy way to traversing multiple relationships.
Unfortunately this named query doesn't work with hibernate:
Code:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: u near line 1, column 111 [SELECT DISTINCT g FROM com.cinerent.starticketmediacenter.server.model.impl.Group g, IN(g.usersSubscribed) AS u WHERE u.username = :username]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:258)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
...
Am I doing something wrong? or is not possible?
Thanks.