-
Notifications
You must be signed in to change notification settings - Fork 677
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
Kotlin Interface projections nullabillity issues #3242
Comments
It's caused by missing column aliases from tuple metadata, not sure Spring Data JPA could handle it, you can fix it by adding alias in your query like IIRC, BTW, you forgot |
@quaff Thanks for you reply, even if I add aliases jpa just puts null to notNullable property and this code
just prints:
But it should in my opinion give some error and not initialize not nullable type with null. I've made change and pushed to the repo fix of alias, so you can reproduce it. Thanks. |
I'm trying to fix it by #3244. |
… result present Fix spring-projectsGH-3242 Signed-off-by: Yanming Zhou <[email protected]>
@quaff @christophstrobl thank you. |
Hi, I'm writing an interface projection and instead of getting some readable error while initializing the result I'm getting a runtime NullPointerException on non-nullable type.
Caused by: java.lang.NullPointerException: Cannot invoke "org.dev.NameWithAgeOnly.getName()" because "customer" is null
Can you please clarify what am I doing wrong. And maybe give some workaround. Isn't it a bug?
I've also tried to use kotlin dto class instead of interface, but then I'm getting
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [org.dev.NameWithAgeOnly]
Here is reproducible example: https://github.com/iPave/jpa-projections-issue/tree/main
The text was updated successfully, but these errors were encountered: