I am using JPA in my project.
I came to a query in which I need to make join operation on five tables. So I created a native query which returns five fields.
We have resolved the issue using following way :
//Add actual table name here in Query
final String sqlQuery = "Select a.* from ACTORS a"
// add your entity manager here
Query query = entityManager.createNativeQuery(sqlQuery,Actors.class);
//List contains the mapped entity data.
List list = (List) query.getResultList();