java - HQL to accept wildcard characters and display the matching records -
my requirement accept wild card in textbox , show matching records. i'm working on maintenance project , not sure how modify existing code written in hibernate(hql) accept wildcard characters in query , display matching records. below wildcard characters condition: % = 0 many characters _ = 1 character
in normal sql query know use accept wild card chacters. please see sample below.
select * emp empname '%_%';
please suggest how when used hibernate(hql).
below sample code:
public actionforward performsearch(actionmapping mapping, actionform form, httpservletrequest request, httpservletresponse response) throws exception { mysearchform searchform = (mysearchform) form; actionmessages messages = new actionmessages(); searchform.getsearchcriteria().setdosearch(messages.isempty()); if (!messages.isempty()) { adderrors(request, messages); } loadformdata(searchform, request); return mapping.findforward("success"); }
Comments
Post a Comment