Joined: Thu Nov 25, 2004 11:44 am Posts: 15 Location: Woodbridge UK
|
Can anyone tell me how one does inner joins using Query by Criteria
My HQL is:
"from Manufacturer manufacturer join fetch manufacturer.contact contact"
which produces SQL like
select ... from MANUFACTURER inner join CONTACT on MANUFACTURER.CONTACT_ID=CONTACT.id
I can simulate the result by doing an eager fetch
Criteria criteria = session.createCriteria(Manufacturer.class);
criteria.setFetchMode("contact", FetchMode.EAGER);
criteria.add(Expression.isNotNull("contact"));
select ... fields from the tables CONTACT and MANUFACTURER ... from MANUFACTURER this left outer join CONTACT on MANUFACTURER.CONTACT_ID=CONTACT.id where MANUFACTURER.CONTACT_ID is not null
Is there a simple way to get the SQL to produce the inner join syntax
Phil Zoio
|
|