I just upgrade to hibernate 2.1.3 with sqlserver and started having a problem where hibernate didn't translate the HQL -> SQL properly when using the sqlserver keyword "user" in the HQL. Unfortunately, sqlserver being irritable, it didn't error...it just returned the user for the given rows of the user table ("dbo") instead of User objects.
Here's the log file.
Code:
13:07:24,279 DEBUG QueryTranslator:199 - HQL: select user from edu.academyart.model.User as user inner join user.coursePermissions as permissions where permissions.course = ?
13:07:24,279 DEBUG QueryTranslator:200 - SQL: select user as x0_0_ from users user0_ inner join rights courseperm1_ on user0_.id=courseperm1_.userid where (courseperm1_.courseId=? )
13:07:24,279 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
13:07:24,289 DEBUG SQL:237 - select user as x0_0_ from users user0_ inner join rights courseperm1_ on user0_.id=courseperm1_.userid where (courseperm1_.courseId=? )
13:07:24,289 DEBUG BatcherImpl:241 - preparing statement
13:07:24,289 DEBUG Loader:197 - processing result set
13:07:24,289 DEBUG Loader:405 - result row:
13:07:24,289 DEBUG Loader:405 - result row:
13:07:24,289 DEBUG Loader:405 - result row:
13:07:24,289 DEBUG Loader:405 - result row:
13:07:24,299 DEBUG Loader:405 - result row:
13:07:24,299 DEBUG Loader:405 - result row:
13:07:24,299 DEBUG Loader:405 - result row:
13:07:24,299 DEBUG Loader:405 - result row:
13:07:24,299 DEBUG Loader:405 - result row:
13:07:24,299 DEBUG Loader:405 - result row:
13:07:24,299 DEBUG Loader:405 - result row:
13:07:24,299 DEBUG Loader:405 - result row:
13:07:24,309 DEBUG Loader:405 - result row:
13:07:24,309 DEBUG Loader:226 - done processing result set (13 rows)
13:07:24,309 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets }
I'll send along my mapping files and such if you think they'll help.
I've worked around this by changing my query to not include the "user" keyword and all is well.
Let me know if you need something to help track this down.