Hibernate Tutorials/
« Previous | 1 | 2 | 3 | Next »
HQL supports INSERT INTO clause only where records can be inserted from one object to another object. Following is the simple syntax of using INSERT INTO clause:

String hql ="INSERT INTO Employee(firstName, lastName, salary)"+
"SELECT firstName, lastName, salary FROM old_employee";
Query query =session.createQuery(hql);
int result = query.executeUpdate();
System.out.println("Rows affected: "+ result);
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com