File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes HQL join returns no results. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "HQL join returns no results." Watch "HQL join returns no results." New topic

HQL join returns no results.

Mark A. Espinoza

Joined: Jun 29, 2010
Posts: 2
Hello all,

I am new to hibernate and am having trouble with making a join query in HQL.
This is between 2 classes with a one-to-many/many-to-one relationship.
I am trying to join in the second class based on matches between 2 columns,
where classA.jono = classB.jono. The relationship is one classA to many classB.
I am using a join table. I excluded the attributes I don't use in this query.
I am running this query in the eclipse HQL editor.



The valid SQL that works is the following:

My HQL running is Eclipse HQL editor:

The HQL will run, no exceptions, warnings, or errors, but will return nothing.
The corresponding join table is empty.
Do I fill it? Does the query fill it? Do I use the "jono" columns somehow in my <set>
declaration? I am lost...despair....must finish...cough...cough. :P

Do you see me needing anything else in my collection definition?

I am running MySQL 5.1 Hibernate 3.3, Hibernate tools 3.2 Eclipse Galileo. Windows XP(not by choice).
Any help appreciated. Let me know of any more details you require.

Mark A. Espinoza

Joined: Jun 29, 2010
Posts: 2
I agree. Here's the link:
subject: HQL join returns no results.
It's not a secret anymore!