Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow kotlin pojos to not have defaulted constructor parameters #13301

Closed
NikolayMetchev opened this issue Mar 17, 2022 · 5 comments
Closed

Allow kotlin pojos to not have defaulted constructor parameters #13301

NikolayMetchev opened this issue Mar 17, 2022 · 5 comments

Comments

@NikolayMetchev
Copy link

Use case:

We are using mapstruct to map from jooq generated kotlin data classes to other classes but because jooq generator defaults all the constructor parameters to null Mapstruct doesn't know how to invoke the constructor as it is Java based.

I have described in detail the use case here: mapstruct/mapstruct#2378 (comment)

Possible solution you'd like to see:

Essentially I think it would be enough to be able to modify the following code and have the = null be configurable:

arguments.add(columnMember + ": " + type + "? = null");

Possible workarounds:

As a workaround we are not using immutable Pojos in the code generator

Versions:

  • jOOQ: 3.14.8
  • Java: 17
  • Database (include vendor): Postgres Aurora 13.4
  • OS: Mac/Linux
  • JDBC Driver (include name if inofficial driver): 42.3.3
@lukaseder
Copy link
Member

Thank you very much for your feature request.

I don't think there's anything specific to immutable POJOs to be taken care of here, compared to the existing feature request here: #10212.

Closing this as a duplicate.

@NikolayMetchev
Copy link
Author

#10212 seems to be a much more generic solution, which I don't know if it will address the mapstruct problem outlined in my request. I guess I will wait for it to get resolved and decide then.

@lukaseder lukaseder reopened this Mar 17, 2022
3.17 Other improvements automation moved this from To do to In progress Mar 17, 2022
@lukaseder
Copy link
Member

OK, I'll keep this one here open, but I can't promise to look at it before the big nullability questions are addressed in #10212

@lukaseder

This comment was marked as off-topic.

@lukaseder lukaseder removed this from In progress in 3.17 Other improvements Jun 21, 2022
@lukaseder lukaseder added this to To do in 3.19 Other improvements via automation Oct 4, 2023
@lukaseder
Copy link
Member

lukaseder commented Oct 4, 2023

In the meantime, I have been convinced to add a few nullability governing flags to the KotlinGenerator, so why not add more. There will be:

<kotlinDefaultedNullablePojoAttributes>false</kotlinDefaultedNullablePojoAttributes>
<kotlinDefaultedNullableRecordAttributes>false</kotlinDefaultedNullableRecordAttributes>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

2 participants