...but you will need to hand-code the queries and reassemble the objects yourself.
Run your first query as:
Quote:
Code:
Query q = session.createQuery("SELECT userSession FROM UserSession userSession left fetch join userSession.transactions");
List result=q.setMaxResults(100).setCacheable(true).list();
Gather all UserTransaction ids into a list.
Run your second query as (pseudo-code):
Code:
select UserRequest ur where ur.transactionId in (<list of UserTransaction ids>);
Manually attach UserRequest results onto their respective UserTransaction parents.
This uses the SQL IN operator, which you will find documented in several places to have bad performance; however, in my experience having a non-performant IN operator is much better than issuing N SQL statements. FYI, Oracle 8i supports up to 1000 elements in an IN list. Be sure to index your id columns.
I am very interested in seeing alternative solutions to this problem.