I have a custom repository where I try to get result with entityManager
This is my query
val QUERY =
"""SELECT new com.service.persistence.entities.PointView(
p.id as id,
p.name as name,
) FROM point p"""
I use it with entity manager
val query = entityManager.createQuery(
QUERY, PointView::class.java
)
.setFirstResult(pageable.offset.toInt())
.setMaxResults(pageable.pageSize)
val points = query.resultList
Locally it works fine but in graalvm native image I get
Cannot set field 'id' to instantiate 'com.service.persistence.entities.Point'%
This is the PointView class
data class PointView(
val id: String?,
val name: String?
)
This is the entity
@Entity(name = "point")
@Table(name = "point")
class PointEo(
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
var id: String? = null,
var name: String? = null,
...
)
How can I solve the instantiate issue here?