Friday, 24 May 2013

Delete Hibernate Criteria/Query

Criteria
 Student student = (Student ) session.createCriteria(Student.class)
                    .add(Restrictions.eq("classId", classId)).uniqueResult();
  session.delete(student);
HQL query:
String hql = "delete from Student where classId= :classId";
session.createQuery(hql).setString("classId", classId).executeUpdate();


0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...