users@glassfish.java.net

Re: jpql Query ignore case

From: Johnny Tolliver <jxt_at_ornl.gov>
Date: Wed, 30 Apr 2008 14:41:33 -0400 (EDT)

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