A major flaw of the Criteria query API is its inability to perform table self-joins, such as querying tables that implement, for example,
nested sets.
Specifically, criteria queries cannot emit queries of form:
Code:
select ... from some_table t1 join some_table t2 ...
Assuming it is still the case that Criteria cannot do self-joins, and there are no workarounds that don't involve faking the self-join through a VIEW that performs the self-join -- I would like to add this functionality to Hibernate, because queries of this type appear throughout our app.
The Criterion query tree data structure captures the self-join fine so the loss of the self-joined alias appears to be happening in the CriteriaLoader phase.
Any devs familar with the source of the query generation engine able to provide some pointers or explain the self-join limitation?
cheers.