Well i have been facing the same issue.
the query works fine if i do not use aliases. but if i use them i keep getting
JDBC exceptions
Jan 31, 2011 3:05:10 PM org.hibernate.type.NullableType nullSafeGet
INFO: could not read column value from result set: id; Column 'id' not found.
Jan 31, 2011 3:05:10 PM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: S0022
Jan 31, 2011 3:05:10 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Column 'id' not found.
This is the query:
HIbernate: SELECT Reports.id reportId,Reports.studyId As 'studyId',Reports.name As 'Name',Reports.type As 'Periodicity',Users.name As 'Created By',Reports.status As 'Status' FROM Studies INNER JOIN Reports ON Reports.studyId=Studies.id INNER JOIN Users ON Users.id=Reports.createdBy WHERE (Studies.id = 127) AND (Reports.templateId IS NULL) AND (Reports.isDeleted = false)
when i copy and paste it in my SQL Browser, i get results.
I would be greatful if someone could shed some light