Got this error “illegal syntax near collection”, the HQL query was something like this
"select p.alias from Person p inner join p.telephoneNos where p.telephoneNos=?".
Person has a one-to-many with telephoneNos and a one-to-many with alias. With the new ASTQueryTranslatorFactory the query works fine, with the old ClassicQueryTranslatorFactory there is an error.
After some fiddling around with the query, the error seems to from the “select p.alias” part. It seems like it can’t parse p.alias. When i change it to just p, it works fine.
So for those using the old query translator do take note of this. Caught me by surprise, so it seems that there is a difference in the old and new query translator.
But why am I using the old translator, in Weblogic Server 10 (or 11g as Oracle now calls it), there is a class loading conflict, they loaded some jars (can’t remember which), so I used the old query translator instead.
You can change the query translator by using the following in your hibernate.properties.
hibernate.query.factory_class=org.hibernate.hql.classic.ClassicQueryTranslatorFactory