I want to delete the list of Object with the getCurrentSession().delete()
method. I found the optional way by writing the query like
getCurrentSession().createQuery("delete from Student where studentId =1").executeUpdate();
And I have come to another solution like
for (Student students : listOfStudents) {
getCurrentSession().delete(student);
}
But it's not a database efficient call as it will create as many queries as the size of list. Is there any other efficient way to delete the list except writing a Hibernate query?