-
Notifications
You must be signed in to change notification settings - Fork 378
Closed as not planned
Closed as not planned
Copy link
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
To retrieve results indexed by a specific column (relation_id), we use "pair" classes. For example;
// Repository method
@Query(
"""
SELECT o.id AS relation_id, c.* FROM customer_details c
JOIN orders o ON o.customer_details_id = c.id
WHERE o.id IN (:ids)
"""
)
suspend fun findAllByOrderIdIn(ids: Iterable<UUID>): List<CustomerDetailsPair>
// ...
// The virtual pair entity
data class CustomerDetailsPair(
override val relationId: UUID,
@Embedded.Empty
override val entity: CustomerDetails,
)
// The CustomerDetails entity
@Table(name = "customer_details")
class CustomerDetails(
val name: String,
var email: String?,
)But this results in the following exception being thrown:
Cannot set property name because no setter, no wither and it's not part of the persistence constructor public oopen.timemachine.entities.CustomerDetails(java.lang.String,java.lang.String)
When changing the name property to a var, no error is thrown. The entity as a standalone entity, so not embedded, can be constructed without changing the property to a var.
Metadata
Metadata
Assignees
Labels
status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid