Is there an option to tell the jOOQ generator to make properties of the generated Kotlin data classes nullable or not nullable depending on whether the column is NULL
or NOT NULL
in SQL.
I know that SQL NOT NULL
does not guarantee this when using joins etc. but I can use records to map them.
I just want to use the data classes to pass them to different layers in the application that don't want to bother with jOOQ stuff, but need the null safety there.
As of jOOQ 3.14, not yet: https://github.com/jOOQ/jOOQ/issues/10212
I know that SQL NOT NULL does not guarantee this when using joins etc. but I can use records to map them. I just want to use the data classes to pass them to different layers in the application that don't want to bother with jOOQ stuff, but need the null safety there.
Just to be very sure here, you will not get null "safety" even with records. You will get a tradeoff, which, if you're very diligent, can give you some convenience. But it is quite likely that you will occasionally run into NPEs.