Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with OUTER JOIN hibernate

 
Mike Halford
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have two classes - abbreviated for clarity.

1:
2:

There are 5 different categories in the categories table and I'm trying to use an outer join to get me the number of times each category occurs in the progress table; e.g.
Error Category A 16839
Error Category B 22871
Error Category C 10
Invalid Entity 6706
No Error 201186

This query is working fine..


EXCEPT that if there are no occurences of a Category in the Progress table
I would like to see Error Category C 0 for example. The trouble is that in such a case the output is:
Error Category A 16839
Error Category B 22871
Invalid Entity 6706
No Error 201186

i.e no count for Error Category C 0.
In good ol' SQL the outer join works fine, but HQL doesn't seem to return null rows. Is this just a feature of HQL or am I doing something wrong???


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic