Tuesday, January 20, 2009

JPQL case insensitive search

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

Ref:

MarkMail

1 comment:

Unknown said...

There are certain things I don't want to joke about. If it's about somebody else, it's fine. If it's about me, I think it's totally insensitive!
See the link below for more info.

#insensitive
www.ufgop.org