I have this query which works great returning arrays of objects
{ [topic, hitsory], [topic, history] etc }
Code:
select topic, history from Topic as topic left outer join topic.topicHistories as history where topic.course = ? and (history.user= ? or history is null) group by topic, history"
As specified, the history object can be null. I tried to change the query to be:
Code:
select topic, isNull(history.postsViewed, 0) from Topic as topic left outer join topic.topicHistories as history where topic.course = ? and (history.user= ? or history is null) group by topic, history.postsViewed"
and hibernate complains that isNull is an undefined alias.
I've plowed through the docs looking for examples of isNull in the select clause without luck. All examples seem to use isNull in the where clause.
Anyone see any obvious stupidities on my part? I've worked around this by checking for null in the results and substituting a zero, but I don't know why my isNull attempt failed.
I'm running on sqlserver... *ick*
I think I'm using hibernate 2.1.1 (Is there an easy way to tell if all you have is the hibernate2.jar left of the download?) but it could be 2.1.2.
-mp