The DELETE clause can be used to delete one or more objects. Following is the simple syntax of using DELETE clause:
String hql ="DELETE FROM Employee "+
"WHERE id = :employee_id"; Query query =session.createQuery(hql); query.setParameter("employee_id",10); int result = query.executeUpdate(); System.out.println("Rows affected: "+ result); |