In our postgreSQL schema we defined a custom datatype that combines two string fields. That custom datatype is stored as an array in one of our tables.
As i am migrating to using the official jOOQ Code Generator plugin for gradle it fails to generate a proper Dao with generic parameters that can accept such an array with the type of the custom datatype.
An example of how this looks like is the SQL script below:
create type my_type as (
a text,
b text
);
create table tax_indicator_t
(
key text primary key not null,
calc_rules my_type[],
);
Running the jOOQ generator generates code that won't compile and throws the following error:
Argument type mismatch: actual type is 'Array?', but 'Array?' was expected.
This is the generator config in gradle:
generator {
name = "org.jooq.codegen.KotlinGenerator"
database {
name = "org.jooq.meta.postgres.PostgresDatabase"
inputSchema = "myapp"
excludes = JOOQ_IGNORED_DATABASE_NAMES.joinToString("|")
schemaVersionProvider = "SELECT 'v' || version || '/' || checksum " +
"FROM myapp.flyway_schema_history ORDER BY version DESC LIMIT 1"
}
target {
packageName = "my.app.generated"
}
generate {
isDaos = true
isSpringAnnotations = true
isDeprecated = false
isRecords = true
isImmutablePojos = true
isFluentSetters = false
isRoutines = true
isIndexes = false
isDeprecationOnUnknownTypes = false
isEmptySchemas = false
isEmptyCatalogs = false
isImplicitJoinPathsToOne = true
isPojosAsKotlinDataClasses = true
isGlobalSchemaReferences = false
isKeys = false
}
}