Hi Mark,
Yep, I had thought of that; however, in my situation I'm dealing with a
stored procedure that is not under my control.  Seems to me this type of
thing should be the job of the mapping layer, anyway.  If implementing the
TypeHandlerCallback is the only iBatis-supported method for doing so, I'm
fine with that - just wanted to make sure there wasn't an easier (ideally
XML/config-based) way...

Thanks,
Todd



On Wed, May 6, 2009 at 12:58 PM, <mark.gil...@assurant.com> wrote:

>
> Todd,
>
> You could use a CAST or CONVERTmethod in the SQL statement itself to do the
> transformation to varchar.
>
> Best regards,
>
> Mark Gillen
> Senior Software Engineer
> Assurant Corporate Technology (ACT)
> Business & Enterprise Application Services
> Miami -T-2, Technology Bldg.
>
> (305) 253-2244 Ext. 32013
> mark.gil...@assurant.com
>
>
>  *Todd Langdon <todd.lang...@gmail.com>*
>
> 05/06/2009 12:52 PM
>  Please respond to
> user-cs@ibatis.apache.org
>
>   To
> user-cs@ibatis.apache.org  cc
>   Subject
> Casting from INTEGER database field to String Object property in
> ResultMap?
>
>
>
>
> Hi,
>
> I have a value that is stored as an Integer in the database but it is a
> string on my domain object.  Is there no way to accomplish this via the
> ResultMap alone?  It was giving me a "Specifed cast is not valid" until I
> implemented a TypeHandlerCallback and specified it in the result typeHandler
> attribute - is that the only way to handle type mismatches between the
> persistence and object layers?
>
> Thanks in advance,
> Todd
>
>  ------------------------------
> This e-mail message and all attachments transmitted with it may contain
> legally privileged and/or confidential information intended solely for the
> use of the addressee(s). If the reader of this message is not the intended
> recipient, you are hereby notified that any reading, dissemination,
> distribution, copying, forwarding or other use of this message or its
> attachments is strictly prohibited. If you have received this message in
> error, please notify the sender immediately and delete this message and all
> copies and backups thereof.
>
> Thank you.
> ------------------------------
>
>

Reply via email to