Ah, found <#C0BLHCSHZ|>, see there <https://kotli...
# spring
p
k
did you inject object mapper in attributeConverter?
p
No, I expected spring boot to do the magic, as I defined the custom ObjectMapper.
Other settings seemed to work
I have JsonDeserializer<PGpoint> and JsonSerializer<PGpoint>
k
hmm, how is that related to jpa?
p
I have a json database field, and inside that json structure there is a PGpoint type field. (I know, its dumb) I created this custom object mapper
Copy code
@Component
class ObjectMapperInitializer {
    @Bean
    @Primary
    fun objectMapper(): ObjectMapper = JsonMapper.builder()
       // .. other options
       .build()
       // .. other options
       .registerModule(SimpleModule().apply {
            addDeserializer(PGpoint::class.java, PGpointConverter.PGpointDeserializer())
            addSerializer(PGpoint::class.java, PGpointConverter.PGpointSerializer())
    })
}
But seems like I misunderstood how to register custom serializers/deserializers
k
yes, but that's related to de/serialization process itself. check this https://bootify.io/spring-data/hibernate-json-type.html or https://www.baeldung.com/hibernate-persist-json-object
🙏 1
depends on which version of hibernate you are using
p
Ah, thanks, so basically
Copy code
@Bean
fun jsonFormatMapper(objectMapper: ObjectMapper): HibernatePropertiesCustomizer =
    HibernatePropertiesCustomizer {
        it[AvailableSettings.JSON_FORMAT_MAPPER] = JacksonJsonFormatMapper(objectMapper)
    }
is the solution for Hibernate 6?
k
looks like
p
Maybe someday I won't need it anymore