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