datapublica / hibernate-pg-json

Provide json/jsonb mapping for hibernate
MIT License
17 stars 3 forks source link

Adding customizations on ObjectMapper #2

Open snowe2010 opened 7 years ago

snowe2010 commented 7 years ago

The documentation could be a little clearer on how to add customizations on the ObjectMapper. I'm not sure how to go about adding our own modifications, without modifying the source code and building locally.

WydD commented 7 years ago

Currently the only way to access to the object mapper is via com.datapublica.pg.types.JsonType.MAPPER.

For instance you can do:

JsonType.MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

anywhere in your config code (even in a static bloc) and it will support the deserialisation of unknown properties without failure.

I know it's not perfect.