java - case-insensitive search in EJB QL -


It looks really simple and I can not believe that I have not got any solutions. I have a bean named Bean, whose name is now, I want to write a finder method which takes the string and looks for people with that string in their name, case-insensitive. Here's my current EJB QL:

  select object (P) from person P war (like P. name? 1)  

I have 2 problems It is:

  1. I want search to be insensitive to the case (above is case-sensitive) and I short () or upper () Update: I'm using J2EE version 1.4 and Glassfish version 2.1, if this is the case.
  2. I have to give an ugly string for the method, i.e. findByString ("% John%") . Is there a way to write EJB QL so that I get the findByString ("john")

CONCAT function, so I think the following should be done:

WHERE (like PK name Kanakat ('%', CONCAT (? 1, '%')))

Edit: The above do not work because the QL grammar is only a choice expression String and input paragraphs in Allows Itr, which is really limited as LOCATE function:

  WHERE LOCATE (p.name ,? 1) & lt; & Gt; It is possible to achieve the same effect by using it. 0  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -