Closed voronovmaksim closed 3 weeks ago
Accessing nested state works by specifying sub-selectors as arguments i.e. JSON_GET(config, 'nestedNode', 'nestedKey')
will access the nested state. When you want to access arrays, you will have to either specify the array index e.g. JSON_GET(config, 'arrayNode', '0', 'arrayNodeKey')
.
Hi @beikov, thank you very much for spotting and fixing my mistake—I really appreciate it! Everything works.
I have a question about using wildcards in array nodes without a hardcoded index. What if I want to find all records where config.arrayNode[*].arrayNodeKey = arrayNodeValue
, regardless of the node index?
It seems that JSON_GET(config, 'arrayNode', '*', 'arrayNodeKey')
is not supported.
What should I do in this case? Should I write my own custom JPQL functions
, or is there an existing solution for this?
What should I do in this case? Should I write my own
custom JPQL functions
, or is there an existing solution for this?
For now, you will have to do that, yes, or you build Blaze-Persistence from source since we recently added support for this via https://github.com/Blazebit/blaze-persistence/issues/1928.
I am very lucky that you've implemented it recently. I will wait for the official release to get the feature instead of writing my own workaround code. Thanks a lot!
I have jsonB column "config"
Entity:
i want to filter by the nodes.
For
simpleNode
it works fineHow to filter by nestedNode(
nestedKey
) and ArrayNode(arrayNodeKey
)?I've tried for
nestedKey
:It doesn't work. For array it also doesn't work.