Open derekm opened 6 years ago
That can be done. It only requires changing the JavaTypeDescriptor. However, I have no time to do it now.
I may try to carve out some time to assist!
Cool, thanks
The JSON-P equivalent for JsonNode
seems to be JsonValue
instead of JsonStructure
. However, just swapping out the implementation of Jackson with JSON-B/JSON-P will mean that any users that rely on JsonNode
serialisation, serialization of beans mapped with Jackson annotations, or users that provide a custom ObjectMapper will run into compatibility issues. Therefore the JSON-B/JSON-P alternative should probably use a different type name and live under a different package.
@vladmihalcea What is your preference w.r.t. the new type names and package name for the JSON-B/JSON-P types?
I've done some initial testing with swapping out Jackson for JsonB/P. Most of the tests are passing but it obviously still needs the aforementioned structural rework: https://github.com/vladmihalcea/hibernate-types/compare/master...JWGmeligMeyling:feature/29
Note: some users may also like that the JsonValue
implementations are Serializable
: #25
I new type would be fine for JSON-P, like jsonb-p
and json-p
. The new type will not use Jackson, so it should not affect users that mapped JsonNode
on their entities.
Jackson is being obsoleted by JSON-P & JSON-B, and the Java community will be moving forward with the industry standards.
It would be nice to see JSON-P's
JsonObject
orJsonStructure
used instead of Jackson'sJsonNode
.It is also possible that adding in JSON-B could allow for typesafe population of POJOs from PostgreSQL
jsonb
columns, but I can't speak as to whether Hibernate could allow for this level of generics, although I would think it could.