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

Lazy collections fetched with EntityGraph load with JOIN

Description

When a @OneToMany(fetch = FetchType.LAZY) List<Bean> beans is included with an EntityGraph, it is loaded with the owner entity with a JOIN. Is this configurable? I tried adding @Fetch(FetchMode.SELECT) but it gets ignored.
Since I need to skip/limit using firstResult()/maxResults(), using EntityGraphs I get

firstResult/maxResults specified with collection fetch; applying in memory!

and having huge result set (over 100000 records, without skip/limit) the query takes minutes.
Using FetchType.EAGER the collection is fetched with a second query, without JOIN.

Is the JOIN fetching hardcoded when using {{EntityGraph}}s? Or is it configurable?

Environment

WildFly 10, MySQL 5.6

Status

Assignee

Unassigned

Reporter

Giovanni Lovato

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

5.2.2
5.0.6
5.1.1

Priority

Major