Re:OO in Python is mostly pointless
by jolux on Thursday January 28, 2021 @01:47AM
(#25938968)
Hibernate and Entity Framework?
[ Parent
| on HN ]
Re:OO in Python is mostly pointless
by imtringued on Thursday January 28, 2021 @06:33AM
(#25940631)
Hibernate is ok technologically but it is a usability nightmare. However its reliance on reflection makes me want to stay away from it.
Re:OO in Python is mostly pointless
by tobyjsullivan on Thursday January 28, 2021 @02:07AM
(#25939061)
Do you care about performance? In my experience, N+1 queries are impossible to avoid with hibernate (or any JPA framework, generally). But maybe I’m just using it wrong.
Re:OO in Python is mostly pointless
by skinkestek on Thursday January 28, 2021 @05:03AM
(#25940113)
See https://vladmihalcea.com/
He has a lot of info on high performance Hibernate and particularly the n + 1 issue.
It should be mostly avoidable.
Re:OO in Python is mostly pointless
by tobyjsullivan on Thursday January 28, 2021 @10:38AM
(#25943485)
Thanks for sharing this.
For anyone else interested, here’s one post he has on the problem: https://vladmihalcea.com/n-plus-1-query-problem/
Re:OO in Python is mostly pointless
by skinkestek on Thursday January 28, 2021 @12:12PM
(#25945028)
Thanks for digging out this direct link.
I haven't been there for a while but I'm fairly sure there should be a few more.
I haven't found that to be the case. In particular I think expecting the ORM to always do the best thing no matter how you use it is folly, ORMs are a tool that you have to take the time to understand in much of their full complexity.
Some would say this makes them a bad abstraction, but to me, data mapping is going to have to happen somewhere, and I would rather be building on someone else's work to write the data mapping for my applications than do it from scratch. You have to know when the ORM is the right tool to use, and when to drop into plain SQL for your querying, because they do not eliminate the need to write SQL, just reduce it significantly.
Re:OO in Python is mostly pointless
by davidspiess on Thursday January 28, 2021 @02:21AM
(#25939133)
We are currently considering moving away from Entity Framework Core. Simple things work fine, but it generates ridiculous queries if stuff gets more complex.
Many ORMs are going to have trouble at some point when you start making more complex queries. I believe using an ORM well is largely in understanding the balance between when its tradeoffs are acceptable and when they are not. Per the other reply, I would probably start with EF Core in new applications, but would not hesitate to add Dapper or just plain SQL with ADO if I saw the need.
Re:OO in Python is mostly pointless
by skinkestek on Thursday January 28, 2021 @04:59AM
(#25940090)
Is there any reason why it needs to be either/or, or are you suffering from OCD light like so many others of us? ;-)