users@glassfish.java.net

Re: jpql Query ignore case

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Wed, 30 Apr 2008 15:21:06 -0700

How about using COLLATE clause for column defin ? That forces MySQL to
do can sensitive comparison

For example create table temp (col1 varchar(30) COLLATE latin1_bin)
insert into temp values ('asd')
insert into temp values ('Asd')

select * from temp where col1 = 'Asd'

returns only one row.

Regards,
Mitesh

Johnny Tolliver wrote:
> On Wed, 30 Apr 2008, Mitesh Meswani wrote:
>
>
>> How about - select e from Entity e where UPPER(e.attr) = UPPER(parameter)
>>
>> glassfish_at_javadesktop.org wrote:
>>
>
>
>>> Hello everyone. I just want to know the correct syntax for the jpqlQuery
>>> in postgresql to ignore the case of the parameter.
>>>
>
> I believe the above should work. I'm not the original poster, but I need the
> OPPOSITE behavior. I'm using MySQL and JPA, and it seems that plain old
> queries are automatically case-INsensitive. I think this is a MySQL thing.
> In MySQL's normal SQL query language, the query can be modified from
>
> select * from Users where username='xxx';
> (which finds xxx, XXX, and everything in between)
> to
> select * from Users where BINARY username='XxX';
> (which finds only XxX)
>
> Is there any way to do that in JPQL?
>
> Johnny S. Tolliver
> Oak Ridge National Laboratory
> tolliverjs_at_ornl.gov, 865-574-1305
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>