Tutorial - Hibernate criteria query example
In our previous post we have seen an example of second level cache. Second level cache in hibernate is very popular and you should know about How to configured second level cache in hibernate , here is a complete step by step example of second level cache. In this post, I am going to show you few examples of Criteria query in hibernate. We all know that Query is one of the core interface in hibernate and here I will show you how to use Criteria query. The org.hibernate.Criteria is an interface and used to fetch the records from the database based on some conditions. Session is a factory for Criteria and can be obtained from the session, To use Criteria you need criterion instances and criterion instances can be obtained from the org.hibernate.criterion.Restrictions, Restrictions is a class having built in static factory method. OK, Lets see few examples of Criteria Query, In this post we are using the same project which we were created in our one-to-many association example ...