openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cedric Hurst <cedric.hu...@gmail.com>
Subject Re: Case-insensitive LIKE comparison in JPQL
Date Wed, 19 Dec 2007 14:10:33 GMT

Thanks Michael, your suggestion worked.  It might be a little tricky to
ensure that the value is lowered every time a named parameter is provided.  
But in my particular case, the Entity bean is only accessed by Session beans
so I have a bit more control over the interaction.

It would be nice to have the ILIKE keyword supported in OpenJPA, though. 
Maybe I'll open a JIRA.


Michael Bouschen-2 wrote:
> 
> Hi Cedric,
> 
> according to the JPQL spec the pattern value following the keyword LIKE 
> must be a string literal or a string-valued input parameter. So I assume 
> the expression lower(:username) is the problem the OpenJPA query 
> compiler is complaining about. As a workaround you could try "lowering" 
> the value for the username input parameter yourself before passing it to 
> the setParameter call. Then the JPQL would look like:
>   SELECT u FROM User u WHERE lower(u.username) LIKE :username
> 
> Regards Michael
> 
-- 
View this message in context: http://www.nabble.com/Case-insensitive-LIKE-comparison-in-JPQL-tp14412491p14417658.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message