Query qry = session.createQuery("From RegistrationBean where ? = ?");
qry.setString(0,searchCriteria);
qry.setString(1,searchField);
searchList =(ArrayList<RegistrationBean>) qry.list();
RegistrationBean Entity class has userName, address, age fields..
I want to search a user by search criteria such as userName, address etc. using the above single query…
But the query is returning me zero results even though the user exist..
what’s the problem?
Both parameters are set to 0 position, the second is not set. The position parameter should be set sequentially.
But the field name should pass in the following way