[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] FetchGroups and eclipselink.weaving.eager=true
|
Hi,
I stumbled upon a little oddity that I would like to understand:
Lets say there are two classes Employee and Address with an unidirectional
one-to-one-relationship from employee to address. The address property will
be eagerly loaded as default.
If I then define a FetchGroup as:
FetchGroup empGr = new FetchGroup();
empGr.addAttribute("name");
to only fetch the "id" and "name" attribute, I observe to following behavior
with eclipselink.weaving.eager=true:
FetchGroup empGr = new FetchGroup();
empGr.addAttribute("name");
TypedQuery<Employee> query = em.createQuery("select e from Employee e where
e.id = 6", Employee.class);
query.setHint(QueryHints.FETCH_GROUP, empGr);
List<Employee> results = query.getResultList();
With the operation 'getResultList()' there are 3 SQL statements logged:
SELECT ID, NAME FROM EMPLOYEE WHERE (ID = ?)
SELECT ID, STARTDATE, NAME, SALARY, ADDRESS_ID FROM EMPLOYEE WHERE (ID = ?)
SELECT ID, ZIP, STREET, STATE, CITY FROM ADDRESS WHERE (ID = ?)
I actually was expecting only the first one. If I switch off
"eclipselink.weaving.eager" then everything works as intended.
My question now: Is this behavior correct and how could it be possibly
explained?
Thank you for your help.
Frank
--
View this message in context: http://old.nabble.com/FetchGroups-and-eclipselink.weaving.eager%3Dtrue-tp29420699p29420699.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.