openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henno Vermeulen <>
Subject eager load performance of *ToOne mappings
Date Fri, 04 Mar 2011 09:55:00 GMT

When I have a Company - Employee - Project structure with all eagerly loaded @OneToMany relations,
selecting companies performs 3 SQL queries independent of the number of companies. I changed
the mapping from Company to Employee to a @ManyToOne or @OneToOne (which you would use for
example for a CEO field in Company). When I then select Companies, OpenJPA will load the Employee.projects
list with one SQL query for each Employee that it has found:

openjpa.jdbc.SQLDiag - load field: 'projects' for oid=468 class entities.Employee

Is this expected behavior? I see this "load field for oid" happening a lot when I eagerly
fetch a part of our domain object graph using FetchPlans.

Henno Vermeulen
Huize Molenaar

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message