Skip to content

How to map custom object to jsonb column with R2DBC driver? #583

Answered by byungcho
byungcho asked this question in Q&A
Discussion options

You must be logged in to vote

I solved the problem by adding PostgresDialect.INSTANCE.simpleTypeHolder to R2dbcCustomConversions constructor.

@Configuration
@EnableR2dbcRepositories
class R2dbcConfiguration {
    companion object {
        const val DRIVER_NAME = "postgresql"
    }

    @Bean
    fun r2dbcMappingContext(
        namingStrategy: ObjectProvider<NamingStrategy>,
        r2dbcCustomConversions: R2dbcCustomConversions
    ): R2dbcMappingContext? {
        val relationalMappingContext = R2dbcMappingContext(
            namingStrategy.getIfAvailable { NamingStrategy.INSTANCE })
        relationalMappingContext.setSimpleTypeHolder(r2dbcCustomConversions.simpleTypeHolder)
        return relationalMappingContex…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by byungcho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant