-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON support functions #841
Comments
How do you want to detect whether a field maps to a JSON column? Mapping a JSON or JSONB field requires a custom type. Personally I use FWIW Many of the JSON functions require the JSON type to be JSONB, I think this already addresses your performance concern for nested operations. |
I'm not sure if the json type implementation vlad provides is sufficient, but we will see. I'd like to support it at least so that users don't have to switch types immediately. I was thinking about using the colum definition or a custom annotation on the entity attribute to detect that. The performance concern I have is about accessing a json field multiple times although it might be possible to use a function that operates on the whole json in a single context similar to what XQuery can do for XML. We'd have to test if using JSONB will help with that, but for text based columns it's definitely worth looking into optimizing this. |
I moved the navigation part into #1155 |
I'd like add cast functions for json and jsonb as well as add support for dereferencing a json attribute via normal path navigation I.e.
jsonAttribute.person.age
In order to make this happen, we need a json metamodel in java that we can query to know what to cast a result to and to decide if a specific navigation operation is allowed. Maybe we could also support that without a model but then the user would have to do casts of the final values.
Using json access functions multiple times in a more complex expression could become inefficient, so we might want to consider wrapping jsonish expressions in a special function that takes care of optimizing this.
Selecting sub-objects of the JSON type should be possible by making use of a JSON binding provider in an internal ObjecBuilder.
In addition we can take a look at adding support for other json functions as well like e.g. functions for adding or removing objects from a JSON object.
This is blocked by #765 which will enable us to model foreign model structures and allow to easily de-reference it.
The text was updated successfully, but these errors were encountered: