r/java • u/celmaibunprieten • Dec 22 '25
I created a wrapper around JPA Criteria API to help with REST search
https://adrian.md/2024/07/14/crop/I created it almost a year ago and wrote an article describing it. Recently published a new version but never really got feedback on it.
Here's the github repo: https://github.com/apulbere/crop
And the demo project: https://github.com/apulbere/pet-shop-crop
26
Upvotes
10
u/CptGia Dec 22 '25
Did you just reinvent graphql?
5
u/_predator_ Dec 23 '25
At that point you might as well use PostgREST or similar products. Exposing your tables / entities 1:1 in your API is already something to avoid IMO, especially when paired with arbitrary filters which will require a ton of indexes on any reasonably large table.
4
u/eshepelyuk Dec 23 '25
As a suggestion, maybe worth making it compatible with https://jsonapi.org/format/ ?
31
u/wildjokers Dec 23 '25
Dev: How many layers of abstraction should we put on top of the DB?
Architect: All of them.
1
u/Reasonable-Raccoon19 Dec 26 '25
Hey Mate, normally I would simply raise a PR, but I am on my mobile. I think the Diamond Type of the comparator LocalDateTimeCriteriaOperator ist wrongly typed. :)
2
u/revilo-1988 Dec 23 '25
Looks interesting, especially since I really dislike the criteria API 😅