I have two tables
Table A
||Col_1||Col_2||
|London| UK |
|Liverpool| UK |
| New York | USA |
Table B
||Col_1||Col_2|| Col_3||
| UK | Europe | 0
| USA | Americas | 1
Using the Criteria class, Restriction Class and FetchMode, Hibernate manages to create a query that looks like this
Quote:
select distinct top 2000
this_.Col_1 as y0_, TableB3_.Col2 as y1_
from TableA this_
left outer join TableB TableB3_ on this_.Col_2= TableB3_.Col_1
where TableB3_.Col_3=1
When really i need the query to be like this
Quote:
select distinct top 2000
this_.Col_1 as y0_, TableB3_.Col2 as y1_
from TableA this_
left outer join TableB TableB3_ on this_.Col_2= TableB3_.Col_1 AND TableB3_.Col_3=1
How can I add to the join predicate, as I need to filter the table before joining.