Hi, I'm new to the forum, and sort of new to Hibernate (and to make things worse: sort of new to SQL ... ).
Using v4.3, I would like to map the following SQL query:
Code:
select hqa1.x, hqa2.x, hqa1.user
from table1 as hqa1
inner join table1 as hqa2
on hqa1.user = hqa2.user
where hqa1.content_id = 15 and hqa2.content_id = 16;
But I can't figure out how this "inner join" should be translated to Criteria. I mean,
Code:
Criteria criteria = HibernateUtil.getSessionFactory().getCurrentSession().createCriteria(qClass).add(Restrictions.eq("content_id", id));
is easy enough for hqa1 and hqa2, but how to inner join them on hqa1.user = hqa2.user? I know it should be a basic question, and I'm not here to lay flat on my back until anyone hands me the correct answer, but a link to an example so I can figure this out would be great. Thanks!