ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Hasler" <Steph...@i2.co.uk>
Subject Returning boolean from <select> statement and Oracle database
Date Fri, 29 Feb 2008 17:38:14 GMT
Hi

 

Because Oracle doesn't allow Boolean types for table columns, I'm using
varchar2 with permitted values Yes/No.

 

If I want to return these as part of a resultMap, I just use a
TypeHandlerCallback and everything works fine.

 

If, however, I want to just return a Boolean value from a <select>
statement, I think iBATIS cannot automatically map from text to Boolean.

 

If I'm wrong, please let me know!

 

At the moment, I'm using a class called  TextBoolean which has a method
setBooleanValue(...) that I just call booleanValue() on once it has been
returned:-

 

  <select id="isFinalized" parameterClass="String" resultClass="
TextBoolean" >

     SELECT finalized booleanValue

       FROM things_to_finalize

      WHERE thing_id = #id#

  </select>

 

This works, but it's a bit messy. It also needs to be plugged together
with my implementation of TypeCallbackHandler in order to keep this
logic in the same place.

 

Is there a neater way to do this?

Preferably one that doesn't require a bit of sneaky wiring outside of
the framework.

 

 

Regards

 

Steve Hasler




-----------------------------------------
The information contained in this e-mail message is intended only
for the personal and confidential use of the recipient(s) named
above. This message may be an attorney-client communication and/or
work product and as such is privileged and confidential. If the
reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are
hereby notified that you have received this document in error and
that any review, dissemination, distribution, or copying of this
message is strictly prohibited. If you have received this
communication in error, please notify us immediately by e-mail, and
delete the original message.
Mime
View raw message