I want to perform search for a particular string that is starting with a particular alphabet.
So, for example if the starting alphabet is 'A'
den it should produce a result which will contain all the strings with alphabet 'A'
.
How do I achieve this ?
My query is as shown below
Query qry = session.createQuery("From RegistrationBean as rb where rb."+searchCriteria+" like %?%");
qry.setString(0,searchField);
Change your query to this:
Query qry = session.createQuery("From RegistrationBean as rb where rb."+searchCriteria+" like ?");
qry.setString(0, "%"+searchField+"%");