Is it possible to write an HQL query (or barring that, a Criteria query) that joins hibernate-mapped classes against a table not mapped by hibernate?
My use case is, for analysis and reporting purposes, I will pre-compute the primary keys of entities I'm interested in for a particular analysis, and store these in a temporary table that I'd like to join against for many queries
So, can I do the equivalent of
Code:
select patientId from Patient
inner join my_temp_table on patientId = my_temp_table.id
where ...
-- or
select patientId from Patient
where patientId in (select id from my_temp_table)
and ...
I assume that Restrictions.sqlRestriction will let me do this for a Criteria query, but I'd much prefer to be able to use HQL. Thoughts?