TreatedRoot misses fetches in query

Description

syntax like this
criteriaBuilder.treat(root, SubClass.class).fetch("subClassField", JoinType.LEFT);
is not working, since only joins are present here
https://github.com/hibernate/hibernate-orm/blob/9ff14a33c78b11f03351748dfe4a5610517325f3/hibernate-core/src/main/java/org/hibernate/query/criteria/internal/QueryStructure.java#L308

I tried to add

to the next line and it seems to work.
Maybe it was intended and I am missing something?

Environment

None

Activity

Show:
Guillaume Smet
December 12, 2018, 8:19 AM

Looks like an oversight.

I know you're familiar with treat, what's your take on this?

could you prepare a test case using our test case template (https://github.com/hibernate/hibernate-test-case-templates/tree/master/orm/hibernate-orm-5)? Or even prepare a PR?

Christian Beikov
December 12, 2018, 8:23 AM

Indeed, this seems to be an oversight and your fix looks reasonable.

George Vinokhodov
December 13, 2018, 9:23 PM

I'll try to add a test

George Vinokhodov
December 14, 2018, 2:47 AM

Opened pull request

Fixed

Assignee

George Vinokhodov

Reporter

George Vinokhodov

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major