Querying criteria for objects with no joins

Is there a way to write a criteria query for objects with no explicit joins? By an explicit join I mean the 2 tables in the database are not foreign key related, but some columns need to be retrieved from both tables, so joins are required in the query. I know that queries that have a connection can be written with an "in" clause, and queries for criteria can be written with criteria "B". I wrote HQL for this case, but please tell me how to write query criteria for this case.

Thank you in advance

+3


source to share


1 answer


In this case, cross join would be the solution, but it is ONLY possible with HQL . Check out doc (small cite):

16.2. Suggestion from article

Multiple classes may appear, resulting in a Cartesian product or cross join.



from Formula, Parameter

from Formula as form, Parameter as param

      

And also we can filter any of these two entities inside the WHERE clause to narrow down the Cartesian product ...

+1


source







All Articles