Tutorial by Examples

Assuming we have a TravelReview table with City names as column "title" Criteria criteria = session.createCriteria(TravelReview.class); List review = criteria.add(Restrictions.eq("title", "Mumbai")).list(); System.out.println("Using equals: "...
Should we wish to retrieve only a few columns, we can use the Projections class to do so. For example, the following code retrieves the title column // Selecting all title columns List review = session.createCriteria(TravelReview.class) .setProjection(Projections.property("titl...
@Filter is used as a WHERE camp, here some examples Student Entity @Entity @Table(name = "Student") public class Student { /*...*/ @OneToMany @Filter(name = "active", condition = "EXISTS(SELECT * FROM Study s WHERE state = true and s.id = study_id)&quot...

Page 1 of 1