Home Hibernate Hibernate4.2 Hibernate Criteria
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Hibernate Criteria

Advertisement
In this section we are giving many tutorials and example of Hibernate Criteria API. These examples will enable you to understand the Criteria API.

Hibernate Criteria - Learn the Hibernate Criteria API and master the Hibernate framework

The Hibernate Criteria query API is used to selectively find the entity from the  persistence store (database). Here you will learn about the different ways of using the Criteria Query.

The Hibernate Criteria API is created in object orient way and Hibernate translate it into the actual SQL. It is the object orient and elegant alternative to the HQL for querying the objects. It provides many options to the developers.

The Hibernate Criteria query allows you to selectively fetch the data from database.

Creating a Criteria instance

First of we will learn how to create the an instance of Criteria?

The interface org.hibernate.Criteria is used to create the query and it repents the query against a particular persistent class. The Session object is used get the instance of Criteria.

Following code shows how you can get the instance of Criteria from the Session object:

Criteria criteria= session.createCriteria(Employee.class);
List employees = criteria.list();

Here are the example us of Criteria query:

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 23, 2013

Related Tutorials

Ask Questions?    Discuss: Hibernate Criteria  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com