The MatchMode.ANYWHERE match the pattern anywhere in the string.
criteria.add(Restrictions.like("videotags", "pattern", MatchMode.ANYWHERE));
Cover All Spring Modules with working examples.
criteria.add(Restrictions.like("videotags", "pattern", MatchMode.ANYWHERE));
Criteria rootCriteria = createCriteria(entityClass);
rootCriteria.add(Restrictions.or(
Restrictions.eq("a","a"),
Restrictions.and(
Restrictions.eq("b","b"),
Restrictions.eq("c","c")
)
));
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();