I am using Jooq 3.14.7 version to generate Kotlin sources. My code base has both Java and Kotlin class and we are transitioning to Kotlin.
I am able to access Jooq sources in Kotlin class like below (FetchBooks.kt)
import project.mobile.generated.databaseBook.tables.references.I_BOOKS; .... .select(I_BOOKS.BOOK_NAME)
But in Java classes I have to go like this below (FetchBooks.java)
import static project.mobile.generated.databaseBook.tables.references.TablesKt.getI_BOOKS; .... .select(getI_BOOKS().getBOOK_NAME())
This seems a pretty messy way in Java. Any suggestions?
You could patch the code generator to generate some annotations, such as
@JvmField for your various properties. There’s currently no hook for such annotations, so this doesn’t work out of the box. Patching will be necessary (or copy pasting the implementation of
JavaGenerator::generateTable and patching only that).
However, I suggest generating your jOOQ code with the
JavaGenerator until your code base is migrated completely to kotlin.