Open andilem opened 11 months ago
We have similar issues with OneToOne-references with three entities using BatchFetchType IN/JOIN/EXISTS:
Record - OneToMany / LAZY - Transaction - OneToOne / BatchFetch - Communication
In some cases the List of Transactions contains Communications that are null.
When removing the @BatchFetch it works as well as expected.
EclipseLink 4.0.2, but also other versions (4.0.1, 2.7.14)
EclipseLink version 4.0.2
When selecting a non-root entity (e.g.
query.select(root.get(child))
) and child has a@ManyToOne
reference with@BatchFetch(value=IN)
, the references of the children are not fetched. They are justnull
, even withfetchType=EAGER
.There is a simple test case attached with
@BatchFetch(value=IN)
query.select(query.from(Record.class).get("user"))
em.createQuery(query).getResultList()
returns users withcompany = null
@BatchFetch(value=IN)
, everything works as expectedeclipselink-batchfetch-selectnonroot.zip