persistence@glassfish.java.net

RE: insensitive search

From: Laurent Yhuel <laurent.yhuel_at_apologic.fr>
Date: Wed, 19 Sep 2007 18:31:49 +0200

I use postgres and I have a native function (pl/pgsql) which I can use in
"native query".
I can't use this function in "named query".

Actually, we have CONCAT, SUBSTRING, TRIM, LOWER, UPPER, LENGTH, LOCATE on
String.

I think function REPLACE is important too.

What's url to log enhancement?

Thanks

 

-----Message d'origine-----
De : James Sutherland [mailto:jamesssss_at_yahoo.com]
Envoyé : mercredi 19 septembre 2007 15:42
À : persistence_at_glassfish.dev.java.net
Objet : Re: insensitive search


I'm not sure if their is a database function that will remove accents, if
there is it is probably database specific, so you will need to consult your
database documentation. There is a function on some databases called
REPLACE which you could use to replace each accent char with the non-accent
char. TopLink Essentials supports this function through the Expression
replace() API, however this function is not part of the JPA Spec so not
accessable through JPQL (please log an enhancement request to have this
function added to TopLink Essentials JPQL support).

As a workaround you can either use a native query to make use of the REPLACE
function uses SQL, or use a TopLink Expression in your named query instead
of JPQL (you will need to use a SessionCustomizer to do this).


---
http://wiki.java.net/bin/view/People/JamesSutherland James Sutherland 
Laurent YHUEL wrote:
> 
> Hi
> 
>  
> 
> I have to search in a column with case insensitive and without accent. 
> 
> Exemple 
> 
> DépAssà => depassa
> 
>  
> 
> Does it possible with named query?
> 
>  
> 
> I view the function LOWER in named query but it’s not enough for me.
> 
>  
> 
> Laurent 
> 
>  
> 
> 
> 
-- 
View this message in context:
http://www.nabble.com/insensitive-search-tf4480523.html#a12777704
Sent from the java.net - glassfish persistence mailing list archive at
Nabble.com.