ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Thompson" <artho...@gmail.com>
Subject Re: silly question regarding cast from char to int
Date Thu, 15 Feb 2007 23:25:34 GMT
thanks jeff,

i was expecting that - it pains me though.  i was hoping to reuse the dao
code base across multiple datasources.  this makes that less elegant because
i can't assume the other datasources will have that same bad database
design.

-andy

On 2/15/07, Jeff Butler <jeffgbutler@gmail.com> wrote:
>
> The easiest resolution is to store numbers in number fields in the
> database!  But I understand if you can't change the database.
>
> It's really best to change the DAOs.  As an alternative, you could change
> the SQL with some database specific code.  For example, in DB2 you could do
> this:
>
> select *
> from some_table
> where integer(database_id) = #java_id#
>
> However be warned that this is a very poor performer and will cause table
> scans.  So it's best to change it in the DAO.
>
> Jeff Butler
>
>
>
>
>
>
>
> On 2/15/07, Andy Thompson <arthomps@gmail.com> wrote:
> >
> > in my database - i've got a value that's of type char.  for example
> > "0000009".  the dao is passing back a request by id where id is 9.  So
> > there's no match.
> >
> > so select * from some_column where database_id = #java_id# returns
> > null.  but select * from some_column where database_id="0000009" returns
> > true.
> >
> > I'd prefer to not have to modify the dao making the request to add 0s to
> > it cause that seems dumb and I can't change the database.
> > what's the easiest resolution here?
> >
> > --
> > Andrew R. Thompson
> > Currently in D.C. Consulting
>
>
>


-- 
Andrew R. Thompson
Currently in D.C. Consulting

Mime
View raw message