You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Robert Glover <ro...@yahoo.com> on 2008/08/01 00:09:39 UTC
Is there a way using Ibator to do a case-insensitive LIKE compare
Disclaimer: I really, really like Ibator and use it in all my projects.
A programmer has inherited one of my projects that uses Ibator. He needs to use Ibator to do some name comparisons on people's names. For example, a database column might contain a value of "John .J. Hancock". He wants to use Ibator to do a "LIKE" compare against "%HANCOCK%". Unfortunately it is Oracle 10i, not MySql. So, no match results because Oracle is case sensitive. (MySql is not case sensitive).
Short of modifying the java code that Ibator generates, is there any way using Ibator to do the "LIKE" as if the column in the database contained "JOHN J. HANCOCK" instead of "John .J. Hancock"?
I realize that one solution would be to create a VIEW of the TABLE that had the column value upper-cased and then run the VIEW into an IBATOR generation, but he would prefer not to have to do that.
Thanks in advance,
Robert (a bit Ibator fan)
Re: Is there a way using Ibator to do a case-insensitive LIKE compare
Posted by Jeff Butler <je...@gmail.com>.
Take a look in the ibator documentation here:
http://svn.apache.org/repos/asf/ibatis/trunk/java/tools/ibator/core/htmldoc/generatedobjects/extendingExampleClass.html
I describe exactly how to extend the generated example classes to add this
functionality.
Jeff Butler
On Thu, Jul 31, 2008 at 5:09 PM, Robert Glover <ro...@yahoo.com>wrote:
> Disclaimer: I really, really like Ibator and use it in all my
> projects.
>
> A programmer has inherited one of my projects that uses Ibator. He
> needs to use Ibator to do some name comparisons on people's names. For
> example, a database column might contain a value of "John .J. Hancock". He
> wants to use Ibator to do a "LIKE" compare against "%HANCOCK%".
> Unfortunately it is Oracle 10i, not MySql. So, no match results because
> Oracle is case sensitive. (MySql is not case sensitive).
> Short of modifying the java code that Ibator generates, is there any
> way using Ibator to do the "LIKE" as if the column in the database
> contained "JOHN J. HANCOCK" instead of "John .J. Hancock"?
> I realize that one solution would be to create a VIEW of the TABLE
> that had the column value upper-cased and then run the VIEW into an IBATOR
> generation, but he would prefer not to have to do that.
>
> Thanks in advance,
> Robert (a bit Ibator fan)
>
RE: Is there a way using Ibator to do a case-insensitive LIKE compare
Posted by Chris O'Connell <oc...@gorillachicago.com>.
What about a query with something like
Select * from table where upper(NAME_COLUMN) like '%input_variable%'
From: Robert Glover [mailto:robertgloverjr@yahoo.com]
Sent: Thursday, July 31, 2008 5:10 PM
To: user-java@ibatis.apache.org
Subject: Is there a way using Ibator to do a case-insensitive LIKE compare
Disclaimer: I really, really like Ibator and use it in all my projects.
A programmer has inherited one of my projects that uses Ibator. He needs
to use Ibator to do some name comparisons on people's names. For example, a
database column might contain a value of "John .J. Hancock". He wants to
use Ibator to do a "LIKE" compare against "%HANCOCK%". Unfortunately it is
Oracle 10i, not MySql. So, no match results because Oracle is case
sensitive. (MySql is not case sensitive).
Short of modifying the java code that Ibator generates, is there any
way using Ibator to do the "LIKE" as if the column in the database
contained "JOHN J. HANCOCK" instead of "John .J. Hancock"?
I realize that one solution would be to create a VIEW of the TABLE that
had the column value upper-cased and then run the VIEW into an IBATOR
generation, but he would prefer not to have to do that.
Thanks in advance,
Robert (a bit Ibator fan)
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.10/1584 - Release Date: 7/31/2008
12:00 PM