I am trying to pass a column name dynamically to the query in hibernate but I have not been able to do so. Can you shed light on how to do this? I have tried Restrictions
like the following:
getCurrentSession()
.createCriteria(Result.class)
.add(Restrictions.eq(option.column_name, "first_test")).list();
Exception:
org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.hibernate.QueryException: could not resolve property:
"test_name,le" of: com..model.Result
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)