We're updating the issue view to help you get more done. 

additional conditions in HQL join clauses

Description

I have a query that I found needs an additional condition in join clause. This is currently not possible with hibernate.

Example:

select dr.id, dr.dueDate, c.name, sd.name, d.id, d.name
from Survey s right outer join s.dueReport dr *** with s.merchandiser = ? ***
join dr.surveyDefinition sd join sd.contractor c,
Merchandiser m
join m.tasks t join t.depot d
where s is null
and t.surveyDefinition = sd
and m = ?

Briefly saying the query searches for all surveys that have not been done yet by particular user. There might be another same surveys made by other users so I need to introduce addional condition in right outer join.

I might also use subselect - the problem is my database is MySQL and this feature is also not available.

Without the solution I will end up with making one master query and thousands details query (list all "tasks" and check if they have been done by particular user by querying survey existence). The number of queries will also grow in time making the function call last longer and longer.

Environment

None

Status

Assignee

Joshua Davis

Reporter

Leszek Gawron

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

2.1.4

Priority

Major