-
Notifications
You must be signed in to change notification settings - Fork 350
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
Interface projections should be backed by Map
instead of the entity object
#1394
Comments
Can you provide the entire stack trace? |
Sure. When calling that from a CommanlineRunner:
|
This is also true if you use converter. It tries to use the converter to create the original entity.
|
Same problem is happening for spring-data-jdbc. |
Map
instead of the entity object
Thanks a lot for the detail. Using Kotlin with non-null by default restricts the usage of projections because we only read a subset of columns that may be not sufficient for object creation with non-null rules in place. In other modules we have started using |
With Spring Data R2DBC, it seems like a projection in a repository always creates the entity object and applies the projection on top of it.
This example:
Will always result in this error:
Failed to instantiate com.example.r2dbc.User using constructor fun
(kotlin.Long, kotlin.String, kotlin.String)
.This is a trivial example to show the error, but since Spring Data R2DBC does not support joins/relationships, actual projections could contain results from joining tables which cannot be represented in an entity presently.
Is there any reason why the entity mapping applies and the projection doesn't proxy through to the raw
io.r2dbc.spi.Row
?The text was updated successfully, but these errors were encountered: