I recently started using hibernate to manage the queries in my webapplication, and encountered a problem for that I've found some forum posts but no satisfying answer.
I often have to fetch joined information from various tables, wherefore I'd like to use a Query element:
Code:
Query query = this.getSession().createQuery
("select distinct fipo from Fipo fipo " +
"left join fetch fipo.gvfis gebs " +
"where fipo.namen1 like :name)
Now I want to filter the set fipo.gvfis as I only want to fetch certain entries.
A native SQL Query would look like this:
Code:
select * from FIPO f left outer join GVFI g on
g.FIPOID = f.FIPOID and g.GVEART = 'GEB' where f.NAMEN1 like ":name";
But as I searched for information on the issues it seems to be impossible to specify this kind of query in HQL.
The suggested workaround is to use filters, but I have no clue how this can be implemented?
Thanks for any hints,
Daniel