0

Whenever, I try to run below method it is giving above error



    public static List<Product> productGettingWithSize(int size) {
        Session session = factory.openSession();
        List<Product> list = null;
        try {
            Criteria criteria = session.createCriteria(Product.class);
            criteria.add(Restrictions.sizeEq("productName", size));
            list = criteria.list();
            if (list.isEmpty()) {
                System.out.println("No Data Found..!!");
            } else {
                System.out.println(list);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }

So, here in this code in DB productName is REDMI so, I m passing 5 as an size but, I m not getting the expected output. So could anyone help me regarding this code or Can any anyone Tell how to use Restrictions(Size), all method related to size or can anyone send me the documentation where it is been explained explicitly. Thank You...!!!

Expecting a solution on This..!!

Giovanni Contreras
  • 2,345
  • 1
  • 13
  • 22

0 Answers0