Hi Tariq,
do you have try to check the object type in your .getResultList() ?
List<Object> results = em.createNativeQuery(sqlStmt).getResultList();
for(Object obj: results){
//check the type of entity
System.out.println("entity: "+obj.getClass());
if(obj instanceof entityTable1){
//cast in entity or do something
}
if(obj instanceof entityTable2){
//cast in entity or do something
}
}
For separate variables :
Or you can subList you results try subList(beginIndex,endingIndex);
Or toArray() ?
Good day
