Hibernate version:3.2.5
Name and version of the database you are using:Oracle 10g XE
Hi,
A quick simple question. Using the Criteria API, how can I make Hibernate generate a restriction on a left join condition rather than on the WHERE clause filter?
i.e. The SQL I'm looking for is like (a) the SQL I get is like (b)
(a) select * from test1
left outer join test2 on test1.name = test2.name and test2.colour = 'red';
(b) select * from test1
left outer join test2 on test1.name = test2.name
where test2.colour = 'red';
The relevant lines of my java code looks something like this;
Criteria criteria = getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(Test1.class, "test1")
criteria.createAlias("test1.test2", "test2", CriteriaSpecification.LEFT_JOIN);
criteria.add(Restrictions.eq("test2.colour", "red" ));
Thanks
|