Skip to content

JSON type unmapping broken since 3.12 #9474

Description

@hank-cp

My question:

Since Jooq start to support json/jsonb database type from v3.12, I have to update my custom Json type bindings from

public class PostgresJSONGsonBinding implements Binding<Object, JsonElement> { ... }

to

public class PostgresJSONGsonBinding implements Binding<JSONB, JsonElement> { ... }

because the codegen Tables changed from

public final TableField<BookRecord, JsonNode> EXTRA = createField("extra", org.jooq.impl.DefaultDataType.getDefaultDataType("\"pg_catalog\".\"jsonb\""), this, "", new JsonbBinding());

to

public final TableField<BookRecord, JsonNode> EXTRA = createField(DSL.name("extra"), org.jooq.impl.SQLDataType.JSONB, this, "", new JsonbBinding());

In pre-3.12 way my custom Bindings could accept any type of object and convert it to JsonNode, but now it accept JSONB type only. It causes all of my previous Type to Record conversions broken.

Is there any way to tell jooq codegen accept Object type but not just JSONB type since v3.12?

My codegen config:

                        forcedTypes {
                            forcedType {
                                userType = 'com.fasterxml.jackson.databind.JsonNode'
                                binding = 'com.laxture.lolth.jooq.binding.JsonbBinding'
                                types = 'jsonb'
                            }
                        }

Versions:

  • jOOQ: 3.12.1

BTW, the document custom binding demonstrations (here and here) are still using Object, it should need to be updated accordingly I guest:)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions