This file contains hidden or 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
| @Formula("JSON_VALUE(JSON_COLUMN, '$.my.json.property')") | |
| private String myProperty; |
This file contains hidden or 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
| cb.equal(cb.function("JSON_VALUE", String.class, | |
| new HibernateInlineExpression(cb, "JSON_COLUMN"), | |
| new HibernateInlineExpression(cb, "'$.my.json.property'")), | |
| new LiteralExpression<>((CriteriaBuilderImpl) cb, String.class, "somevalue")); |
This file contains hidden or 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
| public class HibernateInlineExpression extends LiteralExpression<String> { | |
| public HibernateInlineExpression(CriteriaBuilder criteriaBuilder, String literal) { | |
| super((CriteriaBuilderImpl) criteriaBuilder, literal); | |
| } | |
| @Override | |
| public String render(RenderingContext renderingContext) { | |
| return getLiteral(); | |
| } |
This file contains hidden or 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 = getCriteria(); | |
| cb.equal(cb.function("JSON_VALUE", String.class, | |
| cb.literal("JSON_COLUMN"), cb.literal("$.my.json.property")), | |
| "value"); | |
| /* | |
| * Results in ORA-40454: path expression not a literal | |
| */ |
This file contains hidden or 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
| SELECT | |
| JSON_QUERY(JSON_COLUMN, '$.my.json.property' WITH WRAPPER) AS PROP, | |
| JSON_VALUE(JSON_COLUMN, '$.another.json.property') AS PROP2 | |
| FROM MY_TABLE |