Ok, I've been reading the docs in more detail and looking at examples posted by many. So I removed the typeAlias, the typeHandler from the resultMap, and the parameterMap as well. I then changed my typeHandler mapping to be the following:
<typeHandler javaType="boolean" jdbcType="CHAR" callback="com.sybase.cosmos.dao.impl.ibatis.extentions.YesNoBoolTypeHandlerCallback" />

Unfortunately this still did not resolve my problem. So I read more and more with no solution in sight. Finally I saw from many of the examples that no one was specifying the jdbcType attribute. I thought that this would be needed to correctly map the jdbcType to the javaType, but what the heck! It's late, it's Friday, and I've wasted a large amount of time on this problem. So I removed the jdbcType from the declaration and ... Bravo!!! It worked!

I guess I simply needed a larger hammer to hit me on the head.


Chris Mathrusse
[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553



[EMAIL PROTECTED]

04/21/2006 04:16 PM

Please respond to
[email protected]

To
[email protected]
cc
Subject
TypeHandlerCallback






I'm having some difficulty with a custom TypeHandlerCallback. Working from the example in the user docs I implemented the YesNoBoolTypeHandlerCallback. I declared it in my SqlMapConfig.xml file as follows:


<
typeAlias alias="Customer" type="com.sybase.cosmos.domain.Customer"></typeAlias>
<
typeHandler javaType="boolean" jdbcType="VARCHAR" callback="com.sybase.cosmos.dao.impl.ibatis.extentions.YesNoBoolTypeHandlerCallback" />

I then in the SqlMap that I want to use it in I declare it as follows:

<
typeAlias alias="YesNoTypeHandler" type="com.sybase.cosmos.dao.impl.ibatis.extentions.YesNoBoolTypeHandlerCallback"/>
 
<resultMap id="CustomerResult" class="Customer">
   
<result column="customer_no" property="id" />
   
<result column="activeind" property="active" typeHandler="YesNoTypeHandler" />
....


And I also defined a ParamterMap as follows:

 
<parameterMap id="CustomerParam" class="Customer" >
       
<parameter   property="active"   typeHandler="YesNoTypeHandler" javaType="boolean" jdbcType="VARCHAR" nullValue="N" />
</
parameterMap>


The problem that I am having is when pasing a Customer object into the query I am getting an SQLException being thrown stating:

Implicit conversion from datatype 'CHAR' to 'BIT' is not allowed.  Use the CONVERT function to run this query.



It appears that the ParameterMap is not using the YesNoTypeHandler when binding the parameters to the PreparedStatement.  So what am I missing?


Thanks much...


Chris Mathrusse
[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553

Reply via email to