In the following code I am trying to get a List of Products which contains all the products in the database:
public List getAllProducts() throws
List list = session.createCriteria(Products.class).list();
This will give you all the records of products table from database