2016-08-17 81 views
0

Mapper.xml的MyBatis - 与类型处理器插入 - 抛出java.lang.ClassNotFoundException

<insert id = "insertVacation" parameterType = "Vacation"> 
    INSERT INTO ferias (audit_dt, audit_usuario, audit_st_ope, 
    feri_cfun_cd_mat, feri_fepa_ano, feri_sq, feri_dt_inicio, feri_dt_fim, 
    feri_fsfr_cd, feri_st_pag, feri_ds_obs, feri_st_ad13sal, feri_dt_pagref, 
    feri_st_autorizado, fepa_st_recebe_adferias, feri_fl_periodo_ativo, 
    feri_dt_programacao, feri_dt_autorizacao, feri_tp_programacao, 
    feri_fl_adiantamento_durante, feri_fl_13_durante) 
    VALUES (#{auditDate, typeHandler="br.gov.df.terracap.grh.util.LocalDateTimeTypeHandler"}, #{auditUser}, #{auditStatus}, #{userCode}, 
    #{currentYear}, #{sequencial}, #{initialPeriod}, #{finalPeriod}, 
    #{status}, #{paymentStatus}, #{note}, #{advance13th}, #{paymentDate}, 
    #{statusAuthorized}, #{additional}, #{activePeriod}, #{scheduleDate}, 
    #{authorizationDate}, #{typeProgramming}, #{advanceVacation}, 
    #{advance13thVacation})  
</insert> 

的MyBatis-config.xml中

<typeHandlers> 
    <typeHandler javaType="org.joda.time.DateTime" jdbcType="DATE" handler="br.gov.df.terracap.grh.util.DateTimeTypeHandler"/> 
    <typeHandler javaType="org.joda.time.LocalDateTime" jdbcType="TIMESTAMP" handler="br.gov.df.terracap.grh.util.LocalDateTimeTypeHandler"/> 
</typeHandlers> 

错误时,测试插入

###更新数据库出错。原因: org.apache.ibatis.builder.BuilderException:解析类时出错。 原因:org.apache.ibatis.type.TypeException:无法解析类型 别名'“br.gov.df.terracap.grh.util.LocalDateTimeTypeHandler”'。 原因:java.lang.ClassNotFoundException:找不到类: “br.gov.df.terracap.grh.util.LocalDateTimeTypeHandler”###原因: org.apache.ibatis.builder.BuilderException:解析类时出错。 原因:org.apache.ibatis.type.TypeException:无法解析类型 别名'“br.gov.df.terracap.grh.util.LocalDateTimeTypeHandler”'。 原因:抛出java.lang.ClassNotFoundException:找不到类: “br.gov.df.terracap.grh.util.LocalDateTimeTypeHandler” org.apache.ibatis.exceptions.PersistenceException

回答

0

VALUES(#{auditDate ,类型控制器= “br.gov.df.terracap.grh.util.LocalDateTimeTypeHandler”}

正确:

VALUES(#{auditDate, 类型控制器= br.gov.df.terracap.grh。 util.LocalDateTimeTypeHandler}

*不含引号

相关问题