Franzen, I would solve this differently. Inside the rating mapping file; add a property called "username". Then define that property as:
Code:
<property name="username" formula="
(select myuser.username from User
RIGHT JOIN Rating
on rating.userid = User.id
WHERE rating.id = id)"/>
(I'm guessing at your database structure from the example you gave, so the query inside the formula attribute might no be entirely correct).
At runtime, this will cause hibernate to generate a subselect for the username property. Given that your query is fairly simple; this should work without negatively effecting performance.