I have two HQL queries I am using for a quick-and-dirty unit test. The first looks somewhat like this:
from Foo where SOME_FOREIGN_KEY = 42
The second looks like this:
from Foo as foo
inner join foo.Bar as bar
where foo.SOME_FOREIGN_KEY = 42
The SOME_FOREIGN_KEY column is not the name of something that Hibernate knows is mapped.
For some reason, the first HQL query works, but the second one does not.
My goal here is to get the second version to work, without traversing the object graph to the object identified by the foreign key. For this test, I have a known ID and I only want the objects related to that ID. The object itself on the other end of the relationship is irrelevant. Is this possible?