Assuming you have a handle on the Hibernate Session
object, in this case named session
:
List<Object[]> result = session.createNativeQuery("SELECT * FROM some_table").list();
for (Object[] row : result) {
for (Object col : row) {
System.out.print(col);
}
}
This will retrieve all rows in some_table
and place them into the result
variable and print every value.