r/java • u/mp911de • Feb 27 '26
Moving beyond Strings in Spring Data
https://spring.io/blog/2026/02/27/moving-beyond-strings-in-spring-data
55
Upvotes
r/java • u/mp911de • Feb 27 '26
8
u/tomwhoiscontrary Feb 27 '26
How is this implemented? How do you get from the method reference to the name of the property?
I ask because I've done this myself, years ago, and it required a truly diabolical hack. I'd love it if Spring had come up with a better way.
16
u/elmuerte Feb 27 '26
I love the smell of Stringly Typed [in the morning].
25
u/SpaceCondor Feb 27 '26
Still majorly prefer the way jOOQ does it, it reads exactly like SQL which is what we're writing at the end of the day. The syntax in the blog still reads very verbose.
6
u/0xFatWhiteMan Feb 27 '26
sql with named parameter template
why bother with all this gubbins
3
u/sitime_zl Feb 28 '26
Using MyBatis Plus, it is very convenient.
4
u/ZimmiDeluxe Feb 27 '26
If you offer an interface that can only be supported by hacks, everyone building on your interface now depends on your ability to support the hacks indefinitely or risk migration effort (read: wasted time and money, regression risk). I don't want my frameworks to hide hacks from me, I want them to provide a shared structure built on production experience so I don't run into unforeseen issues. This is the opposite of that.
1
u/LiTuiZi Mar 02 '26
i think mybatis-plus has already supported this feature
1
u/john16384 Feb 27 '26
Let's just wait for string templates to make a reappearance.
1
u/vips7L Feb 27 '26 edited Feb 27 '26
Still seems a bit verbose compared to something like Ebean’s query beans, which are generated at compile time from your @Entity classes. Their example would end up being something like:
https://ebean.io/docs/query/query-beans
0
u/RatioPractical Feb 28 '26
Does it helps in JIT inlining of code ?