-
Notifications
You must be signed in to change notification settings - Fork 364
Closed as not planned
Closed as not planned
Copy link
Labels
status: duplicateA duplicate of another issueA duplicate of another issue
Description
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:
@Table(""""user"""")
data class User(
@Id
val id: Long,
val firstName: String,
val lastName: String
)
interface UserRepo: CoroutineCrudRepository<User, Long> {
@Query("""select concat(first_name, ' ', last_name) as full_name from "user" """)
fun findAllFullName(): Flow<UserFullName>
}
interface UserFullName {
val fullName: String
}
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
?
TapTap21, rotilho and mattelacchiato
Metadata
Metadata
Assignees
Labels
status: duplicateA duplicate of another issueA duplicate of another issue