Last active
September 20, 2024 02:21
-
-
Save leewin12/ff3c557e2b26ee403377a1c044812297 to your computer and use it in GitHub Desktop.
Build JPA 2.0 CriteriaQuery with MySQL JSON column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CriteriaBuilder cb = new CriteriaBuilder(); | |
// = SELECT * FROM entity WHERE JSON_EXTRACT("json_column", "$.path") | |
Root<entity> root; | |
cb.equal( | |
cb.function("JSON_EXTRACT", Integer.class, root.get("json_column"), "$.path"), | |
100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment