User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
No relationships are free. I was just saying that if they *were* all
free (e.g. if accessing the database was free) then we might have
made them eager (though even then we likely would not since it would
have caused the entire object graph to be slurped into memory and
risk blowing the heap the moment you touch any part of it). Although
N-to-1 relationships are a single database access, reading a related
object may involve reading subsequent transitive related objects
from that one, so the cost could grow in unknown ways. It just
depends upon the model and the way the mappings are configured.
-Mike
On 07/01/2015 3:45 AM, Yannick Majoros
wrote:
Hi Michael, Hebert,
Thanks for your answers.
Do you consider it free with caching in mind, or generally
because of the O(1) complexity?
Yes, that was pretty
much it. If all relationship attribute retrieval was free
then they might all have defaulted to being eager, but it
was just about drawing a line where the cost-benefit made
sense. We considered having a global option that would allow
setting/overriding the default for all attributes of a given
type but never got around to spec'ing that out.
-Mike
On 29/12/2014 12:34 PM, Hebert Coelho wrote:
Hello Yannick,
My guess is that to bring a *One relationship from the
database is because it is a "cheap" behavior.
Usually it will not overhead the processor or the
network.
But this is my guess, I believe that some of the JPA
creators could answer that better.
Regards
On 12/29/2014 03:18 PM, Yannick Majoros wrote:
Hello Hebert,
Thanks for your answer. The discussion I've
been involved in our why this is the default, as
stated by the spec. Is this just for historical
reasons. And if it isn't, what is the reasoning behind
that?
Thanks,
Yannick
Le lun. 29 déc. 2014
14:17, Hebert Coelho <hebolive@xxxxxxxxx>
a écrit :
Hello Yannick,
Because it is written in the spec. (:
Take a look at the spec in the section 11.1 that
details the annotations and its defaults.