Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] eager as default for @xxxToOne

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?

Yannick

Le Wed Dec 31 2014 at 14:39:46, michael keith <michael.keith@xxxxxxxxxx> a écrit :
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.



On 12/28/2014 06:54 PM, Yannick Majoros wrote:
Hello,

As a reaction to http://java.dzone.com/articles/eager-fetching-code-smell , could someone explain why EAGER is the default fetch type for @xxxToOne relations?

Thanks,

Yannick Majoros
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top