I have a query:
@Query(
value = "select name, age, now() from received.scheme ;",
nativeQuery = true
)
public {???} selectData()
I cannot create or return an entity for such a scheme as there is no natural id in it, so is there a way to return something like List<Triple<String, Int, LocalDateTime>>?
CodePudding user response:
you can create another class
with the required properties which you want to retrieve from the database and then you can return that class as List<Class>
.
CodePudding user response:
In your code you get the data from: scheme
So the Entity SchemeEntity
should contains those three fields:
- name
- age
- now (creationDate for example it depend on your logic)
Then your method should be like this:
@Query(value = "select name, age, now() from received.scheme ;",
nativeQuery = true
)
public List<SchemeEntity> selectData();