From my experience ORMs are good time savers when you have relatively simple query needs, but fall down when things get really complex.
Problems with JPA/Hibernate
21–30 of 195 posts
Re: Problems with JPA/Hibernate
#22From my experience ORMs are good time savers when you have relatively simple query needs, but fall down when things get really complex.
Nothing prevents you from using raw SQL queries with Hibernate. HQL is just a convenient superset.
Re: Problems with JPA/Hibernate
#23This article is... Questionable at best. I don't think any of this is an argument against JPA, except that the author doesn't like how it works? I also suspect the author doesn't know hibernate that well. For instance selecting just the fields you need is relatively simple with JPQL: SELECT i.url FROM Image i WHERE i.id = ...
Re: Problems with JPA/Hibernate
#24> I love open source, really, but big companies sponsoring open-source projects get most of their income from support or third party tools.
I work for VMware and consequently take some interest as to how my salary comes into being.
If you think VMware makes "most of its income" from supporting Spring, then I think I'd encourage you to spend some time at the investor relations site[0] reading any of the annual or quarterly reports. I'd advise the same for Oracle and Red Hat/IBM.
[0] The advice to use emails or SSNs as primary keys, though: yikes.
Re: Problems with JPA/Hibernate
#25 A User can be considered unique in one context by its email address, or by its social security number
Personally, I'm a fan of giving everything a random UUID, because it's more flexible. It's random and impossible to guess, it scales well because there's no central bottleneck like with an autoincrement, and it's future proof and flexible.What happens when the user changes the email address? What if the social security number changes, because it was wrong or because it actually changes? What if the original unique identifier wasn't a good choice? What if we decide that the user can have multiple email addresses? Then you may end up having to restructure the entire database, which will be a very annoying thing to do. What if you implement additional rules for what an email is allowed to look like and now the constraint fails for existing users, and this correction needs to be propagated to millions of already existing rows?
Real-life personal data is weird and fuzzy. They can violate seemingly sensible rules like being unique, unchanging, or conforming to any rule whatsoever. Best not to let them spread all over the DB and cause trouble later.
Instead, you could just have a random ID that doesn't mean anything and therefore can stay fixed forever, and any user-related metadata stays in the user table, where it can be modified as needed. Plus an UUID is a fixed 16 bytes, which is easy and efficient to deal with.
Re: Problems with JPA/Hibernate
#26Earlier quoted context omitted.
Nothing prevents you from using raw SQL queries with Hibernate. HQL is just a convenient superset.
Actually mixing raw queries with JPQL/Hibernate queries is the worst of all worlds. To get it right, you will end up making explicit calls to let the EntityManager know what you want each side to be doing to play nice.
Re: Problems with JPA/Hibernate
#27Re: Problems with JPA/Hibernate
#28Re: Problems with JPA/Hibernate
#29Earlier quoted context omitted.
One benefit I've been seeing with server side JS is from FAAS like Lamba which can serve unpredictable loads very inexpensively.
How is that a benefit specific to JS? Don't those platforms generally support Java as well?
There are attempts to fix this with e.g. Graal, which effectively does the expensive initialization and reflection at compile time, but there are so many downsides and pitfalls right now with Graal that I don't consider it a serious solution to the problem. It's basically creating a new ecosystem, which means one primary motivation--to take advantage of the Java ecosystem--is much less compelling.
This isn't constrained to the public ecosystem, lots of companies have their own internal libraries, and Java makes it very easy and even encourages doing lots of expensive things at startup, like classpath scanning and pre-caching things. For a long time, Java made explicit decisions to de-prioritize startup time to improve maintainability (reflection/scanning/dynamic classloading) and runtime performance (e.g JIT). This tradeoff doesn't work out so well in a world of ephemeral processes that come and go as demand changes.
I guess what's specific to JS, Go, Python, et al is the cultural emphasis on fast startup. Interestingly these all come from different constraints but the net result is that, in general, you can go from cold to serving traffic much faster than with Java, with a lot less effort.
Re: Problems with JPA/Hibernate
#30—Gavin King, creator of Hibernate
Source:-
https://twitter.com/markuswinand/status/456827165938434048?s...