I was wondering in JPQL (not on the entity mappings) how to explicitly fetch an associated field eagerly.
I have ContactAddressLink (took out the annotations for brevity)
class ContactAddressLink {
Contact contact;
Address address;
... some extra fields ...
}
So I have a query that would go
select cal from Contact c, Address a, ContactAddressLink cal where
cal.contact = c and cal.address = a
Which gives me the query I expected. However, since I would use the addresses after I see a bunch of queries getting the each address.
What I want to do is something like
select cal eager fetch cal.a from Contact c, Address a, ContactAddressLink cal where
cal.contact = c and cal.address = a
I recall seeing something like that, but I can't remember the exact syntax.