Getting error - java.lang.NoSuchMethodError:

Don Nalaka :

This is an extension of another issue (Retrieve data from database using Hibernate with Spring MVC. Error - "java.lang.NumberFormatException: For input string: ").

I just changed my search criteria to add price values. I'm not sure if I have added the HQL correctly. Please assist to check below code.

 @SuppressWarnings("unchecked")
    public List<Items> searchitems(String category_id, String publisher_id,float price_1, float price_2) {

        return sessionFactory.getCurrentSession().createQuery("from Items items where items.category_id = :category_id AND items.publisher_id= :publisher_id AND items.price< :price_1 AND items.price> :price_2")
                .setParameter("category_id",category_id)
                .setParameter("publisher_id",publisher_id)
                .setParameter("price_1", price_1)
                .setParameter("price_2", price_2)
                .list();

    }
Don Nalaka :

My controller was converting price input as an Int where it should have been a float. After changing it to float issue resolved.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=357853&siteId=1