I think you should read about theta-style joins in HQL described in "Java persistance with Hibernate" chapter 14.3.1
Quote:
Theta-style joins
A product lets you retrieve all possible combinations of instances of two or more
classes. This query returns all ordered pairs of Users and Category objects:
from User, Category
Obviously, this isn’t usually useful. There is one case where it’s commonly used:
theta-style joins.
In traditional SQL, a theta-style join is a Cartesian product together with a
join condition in the WHERE clause, which is applied on the product to restrict
the result.
In HQL and JPA QL, the theta-style syntax is useful when your join condition
isn’t a foreign key relationship mapped to a class association. For example,
suppose you store the User’s name in log records, instead of mapping an association
from LogRecord to User. The classes don’t know anything about each other,
because they aren’t associated. You can then find all the Users and their
LogRecords with the following theta-style join:
from User user, LogRecord log where user.username = log.username