Birlasoft Interview Question: How do you execute native que... | Glassdoor.co.in

Interview Question

Senior Software Engineer Interview Hyderabad

How do you execute native queries in hibernate

Answer

Interview Answer

1 Answer

1

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);
}

Interview Candidate on 18-May-2019

Add Answers or Comments

To comment on this, Sign In or Sign Up.