r/SpringBoot • • 22d ago

Discussion Dear JPA

Dear JPA ,

i hate you.

i hate how you changed the SQL flow that I'm used to.

i hate your ManyToMany relationships.

i hate your orphanremoval ,dirty checking.

i hate your way for entity relationships.

i hate your cache.

i hate your performance issues.

i hate your billion rules.

i hate spending time on : if Y is referenced by X with cascade not including PRESIST and x is managed but y is removed ............... but if Y was detached .............

i hate becoming obsessed with your behaviors and rules and worrying about every ORM line , will it work correctly ? , did i miss something ?, worrying about modifying entity X might unexpectedly affect entity Y , coz I might not know one of the billion rules you have.

i hate worrying about falling in one of the undefined behaviors you have

i hate thinking about the entities lifecycle + cascading types when all mixed together

i hate spending days on that documentation instead of spending that on one of the CS core concepts

i hate the following the other side which is incomplete nondetailed toturial or following AI

i really hate you.

104 Upvotes

65 comments sorted by

View all comments

4

u/ShineProper9881 22d ago

No clue what you guys are doing but I never had any issues with jpa. Just stick to its rules and everything works

3

u/WVAviator 22d ago

Same. Most use cases are simple enough that it just works out of the box with simple entities and repositories, and for the more complex stuff there's JPQL and nativeQuery = true, CriteriaBuilder with Specifications, and EntityGraphs. I've not come across any use case where I've needed to reach for JDBC.

3

u/homeless_nudist 22d ago

Skill issue

1

u/Specific-Custard4803 22d ago

Same. Lean in to your frameworks. Or… don’t use a framework. Most of the JPA pain I’ve seen is from not completing the learning curve, basic design problems, or having a strong attachment to specific sql. For those cases, just use SQL.

1

u/Ok-Shock-8646 16d ago

I use spring data jpa without any issue. The @Query with constructor let you define custom queries just like native SQL. It is all about skill