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.
Not sure if this fits here, but I had similar question and found following simple solution/example for me:
private EntityManager entityManager;
...
final String sql = " SELECT * FROM STORE "; // select from the table STORE
final Query sqlQuery = entityManager.createNativeQuery(sql, Store.class);
@SuppressWarnings("unchecked")
List results = (List) sqlQuery.getResultList();
In my case I had to use SQL parts defined in Strings somewhere else, so I could not just use NamedNativeQuery.