I have jooq generating Kotlin classes from a database (mysql) with no problem.
Here is my maven config:
<configuration>
<generator>
<name>org.jooq.codegen.KotlinGenerator</name>
<database>
<inputSchema>itr</inputSchema>
</database>
</generator>
</configuration>
According to the docs https://www.jooq.org/doc/latest/manual/code-generation/kotlingenerator/, the kotlin generator pojosAsKotlinDataClasses
is true
by default, but this setup is not generating any data class ...
classes.
I just want a plain DTO data class for each table in addition to the other classes generated.
My maven command is:
mvn -Djooq.codegen.jdbc.url='jdbc:mysql://localhost:3306/testdb' -Djooq.codegen.jdbc.username=root\
-Djooq.codegen.jdbc.password=root -Djooq.codegen.target.packageName=com.example.module.domain\
-Djooq.codegen.target.directory=src/main-generated/kotlin\
generate-sources
I have a table called Role and I want a DTO like this:
data class RoleDTO(val id: String, val name: String, val description: String)
However, I'm just getting the following generated classes:
./DefaultCatalog.kt
./keys
./keys/Keys.kt
./Itr.kt
./tables
./tables/Role.kt
./tables/records
./tables/records/RoleRecord.kt
./tables/references
./tables/references/Tables.kt
None of these are a DTO like I would like. How do I do tell jooq to generate my DTO?
<pojosAsKotlinDataClasses/>
just governs the style of generated pojos, but you have to activate <pojos/>
explicitly to get any data classes. See: