It's not a secret anymore!*
The moose likes Object Relational Mapping and the fly likes Problem with OUTER JOIN hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Problem with OUTER JOIN hibernate" Watch "Problem with OUTER JOIN hibernate" New topic
Author

Problem with OUTER JOIN hibernate

Mike Halford
Ranch Hand

Joined: Jul 13, 2005
Posts: 31
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???


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with OUTER JOIN hibernate