---------------------------------------------------------------------------
Here's my SQL Map Config.
---------------------------------------------------------------------------
<sqlMapConfig >
<typeHandler jdbcType= "VARCHAR" javaType= "java.lang.Boolean" callback= "clo.is.sample.ibatis.CharBooleanHandler" />
<sqlMap resource= "clo/is/sample/ibatis/UserAccount.xml" />
<sqlMap resource= "clo/is/sample/ibatis/ProjUser.xml" />
</sqlMapConfig >
---------------------------------------------------------------------------
Here's part of ProjUser.XML
---------------------------------------------------------------------------
<typeAlias alias= "projUser" type= "org.birdsource.core.db.ProjUser" />
<insert id= "insertProjUserComplete" parameterClass ="projUser" >
INSERT INTO PROJ_USER (
PROJ_ID, USER_ID, PROJ_PERIOD_ID, GROUP_ID,
GIFT_USER_ID, PAID, FEE_ID, BEGIN_DT,
END_DT, AUTH_GROUP, AUTH_VAL1, AUTH_VAL2,
AUTH_VAL3, AUTH_VAL4, CREATE_USER_ID, CREATE_DT,
EDIT_USER_ID, EDIT_DT,
REGISTRY_DT,
ENABLED,
NOTES,
MULTI_USE,
REQUEST_ID, TRANSACTION_ID
) VALUES (
#projID:VARCHAR#, #userID:VARCHAR#, #projPeriodID:VARCHAR#, #groupID:VARCHAR#,
#giftUserID:VARCHAR#,
#paid,jdbcType=VARCHAR,javaType=java.lang.Boolean#,
#feeID:VARCHAR#, #beginDate:DATE#,
#endDate:DATE#, #authGroup:VARCHAR#, #authVal1:VARCHAR#, #authVal2:VARCHAR#,
#authVal3:VARCHAR#, #authVal4:VARCHAR#, #createUserID:VARCHAR#, #createDate:DATE:SYSDATE#,
#editUserID:VARCHAR#, #editDate:DATE:SYSDATE#,
#registryDate,jdbcType=DATE,javaType=java.util.Date#,
#enabled,jdbcType=VARCHAR,javaType=java.lang.Boolean#,
#notes:VARCHAR#,
#multiUse,jdbcType=VARCHAR,javaType=java.lang.Boolean#,
#requestID:VARCHAR#, #transactionID:VARCHAR#
)
</ insert >
---------------------------------------------------------------------------
Here's my CustomTypeHandler. I never see the "setParameter: object is null." message even when
the paid property is null.
---------------------------------------------------------------------------
package clo.is.sample.ibatis;
import java.sql.SQLException;
import com.ibatis.sqlmap.client.extensions.ParameterSetter;
import com.ibatis.sqlmap.client.extensions.ResultGetter;
import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback;
/**
* @author pea1
*
*/
public class CharBooleanHandler implements TypeHandlerCallback {
}
At 12:35 PM 5/3/2006, Niels Beekman wrote:
Hi,
Could you post the actual typehandler code and the piece of SQLMap where
you use it?
-----Original Message-----
From: Paul Allen [ mailto:[EMAIL PROTECTED]]
Sent: woensdag 3 mei 2006 18:32
To: [email protected]
Subject: boolean type handler
I've seen some threads that describe how to make a custom type handler
to
map from a Boolean bean property to a CHAR SQL type and I've implemented
one version of them. What I am trying to get is this mapping:
object property value --> DB value
Boolean.TRUE --> "1"
Boolean.FALSE --> "0"
null --> null
However I keep coming up with the same problem, by the time the
setParameter(ParameterSetter setter, Object parameter) method of my
handler
is called, the parameter is always a Boolean object, even when I think
it
should be null because the Boolean the property from my bean is null.
Is there anyway around this?
