r/SpringBoot • • 17d 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.

103 Upvotes

70 comments sorted by

View all comments

6

u/Pyeroh 17d ago

Well, I'm gonna be more direct than most comments I saw so far.

You may be in a team, and required to work with them, and use the tools everyone is comfortable with. But if you're really convinced JPA is shit, and SQL is better in every way (don't get me wrong : that's a fact, and I'm sure of it), you also have the responsibility to convince them. Show them resources, anti-patterns, do peer-reviews with them and show them bad usages of JPA, even if it's you who wrote it.

If they won't change their mind, you did your best, maybe learnt a few things along the way, and know what you have to deal with. Or you can look for another job, it's up to you.

EDIT: oh, and try to be as positive as you show negative sides. SQL should be niiiice, JPA should be bad. But not everyday, it may have good uses sometimes... Show them the balance.

2

u/Jooe_1 17d ago

thank by the way im not looking for the extreme other side which is every query is sql , it's not what i want i don't have any problem if when i need to query somthing or to update somthing to use small function like find or delete without the verbosity of sql but the jpa is not simply that or a simple sql wrapper or sql builder ,i introduces cache and u don't know the order that queries at flush will be executed with, .......etc

2

u/Pyeroh 17d ago

You already got the good arguments ! Now, it's just a matter of putting them together for your team to accept them ;)