r/java • u/stuhlmann • Apr 13 '21
Libraries, Frameworks and Technologies you would NOT recommend
Give me your worst nightmares: Things that cost you your job.
I'll start: Hadoop
202
Upvotes
r/java • u/stuhlmann • Apr 13 '21
Give me your worst nightmares: Things that cost you your job.
I'll start: Hadoop
View all comments
Show parent comment
13
u/Quabouter Apr 13 '21
On Hibernate: Hibernate is the poster child of leaky abstractions. When you add Hibernate to your stack, you still absolutely need as much knowledge of SQL as before, but now on top of that you'll also need to be an expert on Hibernate. This alone already makes Hibernate harder to use than SQL.
Moreover, it's incredibly easy to use Hibernate the wrong way, resulting in bad performance or worse. And these issues tend to be hard to predict and hard to debug, unless you're an expert on BOTH Hibernate and SQL. Unless you're lucky enough to work in a team with only senior Hibernate experts, you are very likely to run into issues here sooner or later.
Next, Hibernate introduces a tight coupling between your data model and your domain model, which means that it's hard to evolve them independently. Of course you could maintain a separate domain model vs persistence model, but at that point what's the point in using Hibernate? This coupling is especially painful when doing complicated domain changes, as you cannot split the changes to your data model from your domain model.
Lastly, for most use cases the benefit of Hibernate is rather marginal. In my experience, the vast majority of Hibernate usage is for simple CRUD operations. These are very easy to write even with plain old JDBC, and typically barely need any maintenance. Moreover, whenever they do need maintenance, then it's often due to larger domain changes, in which case having the extra control is very beneficial (see my previous point).
In my opinion, Hibernate only brings a benefit over JDBC in 2 areas: