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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -