persistence@glassfish.java.net

Re: case insensitive

From: TianMing Pan <Tpan_at_agilitylogistics.com>
Date: Tue, 15 Jan 2008 04:43:24 +0300

Hi Michal,
      I got it. The problem is resolved. Thanks a lot for your help.

Rds
Michael Bouschen wrote:
> Hi,
>
> what Gordon proposed works when using native SQL queries in JPA.
> Unfortunately, the Java Persistence query language only supports
> string literals and input parameters as pattern value following the
> keyword LIKE, so using the UPPER function is not supported here. But
> you can use the following WHERE clause:
> WHERE UPPER(c.name) LIKE :name
> and then pass the upper case value as actual parameter value:
> query.setParameter("name", string.toUpperCase());
>
> Regards Michael
>
>> You could convert your query to : WHERE UPPER(c.name) LIKE UPPER(?1)
>>
>> --Gordon
>>
>> -----Original Message-----
>> *From:* TianMing Pan [mailto:Tpan_at_agilitylogistics.com]
>> *Sent:* Monday, January 14, 2008 6:16 AM
>> *To:* persistence_at_glassfish.dev.java.net
>> *Subject:* case insensitive
>>
>> Hi,
>> When I use the JPA, I am confuse about its query for how to
>> make
>> it case insensitive.
>> For exampe, if I search in the db as "c.name like ?1" and
>> setParameter 1
>> as "china", then
>> the result will not include the "China". So could you tell me how to
>> make the query case
>> insensitive? Thanks a lot.
>>
>> Rds
>>
>>
>> All Business is handled subject to our General Trading
>> Conditions. A copy can be made available upon request.
>>
>
>
> --
> Tech_at_Spree Engineering GmbH Tel.: +49/(0)30/235 520-33
> Buelowstr. 66 Fax.: +49/(0)30/217 520-12
> 10783 Berlin mailto:mbo.tech_at_spree.de
>
> Geschaeftsfuehrung: Martin Weber
> Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.2/1224 - Release Date: 1/14/2008 5:39 PM
>



All Business is handled subject to our General Trading Conditions. A copy can be made available upon request.