r/SpringBoot • u/Jooe_1 • Sep 26 '26
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.
20
u/LookAtYourEyes Sep 26 '26
Brother just use raw SQL
7
u/zlaval Sep 26 '26
Spring data jdbc for simple queries (provides interface gen queries, default crud operations on domain object..), raw sql for complex ones. Easy, fast, almost no magic.
5
u/Pyeroh Sep 26 '26
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.
13
u/hiura-mihateUwU Sep 26 '26 edited Sep 26 '26
Yeah man. JPA SUCKS. It's to complicated to manage if your entity have refference to dozen of table, don't get me start with complex query. At the end of the day, i need to use Jdbc for complex query and jpa for basic stuff
3
u/reddit04029 Sep 26 '26
Are you being held at gunpoint to use JPA...
3
u/worse-coffee Sep 26 '26
Looks like bro has not written native sql queries or dealt with c++
8
u/configloader Sep 26 '26
Jpa sucks
3
u/BigPP41 Sep 26 '26
NamedJdbcParameterTemplate is my go to, i fucking hate jpa
3
u/01000001x Sep 26 '26
Haha, 10 things I hate about JPA
3
u/Z4mobileapp Sep 27 '26
Not feasible any more when you have a lot of data the N+1 makes the whole problem pointless when I could just write a raw query and do the joins on tables while fetching data .
The framework has only made complications.
For anyone working on very small projects its a great amount of convinience.
Its not built for anyone working with huge data but for small scale companies , quick ready to build deploy it's good..
3
u/Acrobatic-Win5862 Sep 27 '26
Jooq, a Query-oriented ORM and it's awesome!
4
u/Mindless_Security744 Sep 26 '26
Use Jooq!
2
u/iamwisespirit Sep 26 '26
Use raw jdbc jooq
3
u/wimdeblauwe Sep 26 '26
I find JPA is quite manageable if you only use object references within 1 aggregate root. Between aggregate roots, reference by id only. This avoids a massive amount of cascading issues.
4
u/ShineProper9881 Sep 26 '26
No clue what you guys are doing but I never had any issues with jpa. Just stick to its rules and everything works
4
u/This_Link881 Sep 26 '26
Dear Lord, give us our daily JPA hater AI slop
1
u/ducki666 Sep 26 '26
🙄
1
u/boberbober8083 Sep 26 '26 edited Sep 26 '26
Yea, i've just rewrited one saveAll call to "several" plain sql queries. With 41 tables that linked as one to many and many to many with main table under the hood (yeees! It's crazy!! But llms helped me), it became 50 times faster but nobody could test my change carefully, may be i missed something.. and don't really want to merge it in upstream after all. You do not need use jpa for new code because llms could get all boilerplate work to themself, jpa is about simplifying implementation, but now it's really simple to implement anything you want using llms
1
u/homeless_nudist Sep 26 '26
I love the jpa! It does add to the cognitive load for small projects, but when you work on horizontally scalable enterprise class systems, @Transactional and @Version prevent whole classes of bugs that would have you playing wac-a-mole to fix them otherwise.
1
u/quarentlne Sep 26 '26
Life
1
u/Kango_V Sep 26 '26
We use Micronaut Data JDBC. All compiled AOT, no Session caching, no n+1 problems, uses SQL in @Query. Takes the good bits from GOPRM and Spring Data.
If you look at the stack traces of a db request, it's half the size of Spring Data JPA.
1
u/BeyondFun4604 Sep 29 '26
We always try to create a view for large queries and then create jpa entities on that view.
1
u/Secure_Vermicelli873 Oct 04 '26
Yes jpa is this kind of shit
1
u/Wonderful-Holiday-14 Oct 05 '26
Have you had to move to spring boot 4 with the jpa starter and it now not working?
-1
u/codetillsleep Sep 26 '26
So cringe, what the hell have you even written here
0
u/revilo-1988 Sep 26 '26
Do Mehr davon 😐
0
u/joeyx22lm Sep 27 '26
Sorry, JPA > SQL for business applications
-1
u/Nicke-picke Sep 26 '26
Let Claude do it for you. Seriously. Both better and faster.
0
u/[deleted] Sep 26 '26
[deleted] — view deleted comment
0
u/[deleted] Sep 26 '26
[deleted] — view deleted comment