Birlasoft Interview Question

How do you execute native queries in hibernate

Interview Answer

Anonymous

May 18, 2019

SQLQuery q= session.createSQLQuery(select I'd,name, salary from table); List res= q.list(); List listEmp; for(object[] obj: res) { Employee e= new Employee(); e.setId(Long.parseLong(obj[0].toString())); listEmp.add(e); }

1