What's wrong with this HQL? "No data type for node"

Solution 1:

You haven't defined the "gs" alias. You only have "ags" and "tgs".