去为空默认NUL的值时报错 加了resultMap后 设置了 Nullvalue后还是不行 上码 大虾们先看看
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd"><sqlMap namespace="ApplyGroup"> <typeAlias alias="applygroup" type="com.ceno.smile.domain.ApplyGroup" /> <resultMap id="applygroup" class="com.ceno.smile.domain.ApplyGroup">
<result column="id" property="id" jdbcType="Integer" nullValue=" "/>
<result column="APPLYID" property="applyId" jdbcType="Integer" nullValue=" "/>
<result column="MANGENAME" property="mangeName" jdbcType="String" nullValue=" "/>
<result column="APPLYCONTENT" property="applyContent" jdbcType="String" nullValue=" "/>
<result column="APPLYTIME" property="applyTime" nullValue=" "/>
<result column="GROUPNAME" property="groupName" jdbcType="String" nullValue=" " />
<result column="CREATETIME" property="createTime" nullValue=" "/>
<result column="PERMITMAN" property="permitMan" jdbcType="Integer" nullValue=" " />
<result column="REMARK1" property="re1" jdbcType="String" nullValue=" "/>
<result column="REMARK2" property="re2" jdbcType="String" nullValue=" "/>
<result column="ISPASS" property="isPass" nullValue=" " />
</resultMap> <select id="getApplyGroupCount" resultClass="int">
<![CDATA[
select count(*) from applygroup
]]>
</select>
<select id="getApplyGroupListForPage" resultClass="applygroup">
<![CDATA[
select * from applygroup
]]>
</select> <delete id="delApplyGroupById" parameterClass="int">
<![CDATA[
delete from applygroup where id=#id#
]]>
</delete>
<!--批量删除 -->
<delete id="deleteApplyGroup" parameterClass="java.lang.String">
<![CDATA[
delete from applygroup where id in
($ids:String$)
]]>
</delete>
</sqlMap>Model 对照看下 谢了public class ApplyGroup {
private int id;// id
private int applyId;// 申请人的id
private String mangeName;// 管理人群主名称
private String applyContent;// 申请内容 提交的申请
private String groupName;// 组名
private Date applyTime;// 申请时间
private Date createTime;// 创建时间
private int permitMan;// 审批同意人的id
private String re1;// 备注1
private String re2;// 备注2
private String isPass;// 审核是否通过 Y/Nerror:--- The error occurred in com/ceno/smile/persistence/sqlmapdao/sql/applygroup.xml.
--- The error occurred while applying a result map.
--- Check the getApplyGroupListForPage-AutoResultMap.
--- The error happened while setting a property on the result object.
Caused by:
com.ibatis.common.exception.NestedRuntimeException: Error setting properties of '2愤怒的小鸟申请技术讨论null'. Cause: java.lang.IllegalArgumentException
Caused by: java.lang.IllegalArgumentException
数据库字段都为空 没有默认值
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd"><sqlMap namespace="ApplyGroup"> <typeAlias alias="applygroup" type="com.ceno.smile.domain.ApplyGroup" /> <resultMap id="applygroup" class="com.ceno.smile.domain.ApplyGroup">
<result column="id" property="id" jdbcType="Integer" nullValue=" "/>
<result column="APPLYID" property="applyId" jdbcType="Integer" nullValue=" "/>
<result column="MANGENAME" property="mangeName" jdbcType="String" nullValue=" "/>
<result column="APPLYCONTENT" property="applyContent" jdbcType="String" nullValue=" "/>
<result column="APPLYTIME" property="applyTime" nullValue=" "/>
<result column="GROUPNAME" property="groupName" jdbcType="String" nullValue=" " />
<result column="CREATETIME" property="createTime" nullValue=" "/>
<result column="PERMITMAN" property="permitMan" jdbcType="Integer" nullValue=" " />
<result column="REMARK1" property="re1" jdbcType="String" nullValue=" "/>
<result column="REMARK2" property="re2" jdbcType="String" nullValue=" "/>
<result column="ISPASS" property="isPass" nullValue=" " />
</resultMap> <select id="getApplyGroupCount" resultClass="int">
<![CDATA[
select count(*) from applygroup
]]>
</select>
<select id="getApplyGroupListForPage" resultClass="applygroup">
<![CDATA[
select * from applygroup
]]>
</select> <delete id="delApplyGroupById" parameterClass="int">
<![CDATA[
delete from applygroup where id=#id#
]]>
</delete>
<!--批量删除 -->
<delete id="deleteApplyGroup" parameterClass="java.lang.String">
<![CDATA[
delete from applygroup where id in
($ids:String$)
]]>
</delete>
</sqlMap>Model 对照看下 谢了public class ApplyGroup {
private int id;// id
private int applyId;// 申请人的id
private String mangeName;// 管理人群主名称
private String applyContent;// 申请内容 提交的申请
private String groupName;// 组名
private Date applyTime;// 申请时间
private Date createTime;// 创建时间
private int permitMan;// 审批同意人的id
private String re1;// 备注1
private String re2;// 备注2
private String isPass;// 审核是否通过 Y/Nerror:--- The error occurred in com/ceno/smile/persistence/sqlmapdao/sql/applygroup.xml.
--- The error occurred while applying a result map.
--- Check the getApplyGroupListForPage-AutoResultMap.
--- The error happened while setting a property on the result object.
Caused by:
com.ibatis.common.exception.NestedRuntimeException: Error setting properties of '2愤怒的小鸟申请技术讨论null'. Cause: java.lang.IllegalArgumentException
Caused by: java.lang.IllegalArgumentException
数据库字段都为空 没有默认值
解决方案 »
- poi.hwpf 操作word 越详细越好
- 用XStream遇到date类型,该怎么处理
- JTextField问题
- XML中的xsl问题!请高手指教,急急急!!!!
- 关于这个事务回滚的问题,我已经列出比较详细的过程了,希望大家帮忙解决
- 热加载的问题.修改了配置文件,可在不重启应用的情况下将新参数载入到系统中.
- 关于DAO问题(struct + spring + hibernate)
- 新手做了个时钟,可以看日历,还可以在桌面自动显示照片
- 求struts和pager标签做的分页例子(100分!在线等!!!!急!)
- 【weblogic】deploy一问
- 如何生存根证书和证书链?
- webservice tomcat生成wsdl文件内容(IP地址相关)却是内网地Ip地址
<resultMap id="applygroup" class="com.ceno.smile.domain.ApplyGroup">
你这个定义都没用到。那定义了做什么?
是不是你实体的int和Integer对不上导致的?改成对象试试
要用这个定义的话,<select id="getApplyGroupListForPage" resultClass="applygroup">
<![CDATA[
select * from applygroup
]]>
</select>这里改为resultMap,如果还不行的话,你定义的 nullValue=" "这里Integer类型的加空串是不行的,要加0或者其他值试下
引用 4 楼 rightxiang 的回复:可以了 使用resultMap 把时间默认值去了 把int类型的nullvalue空字符去了 改成0就哦了
记得结贴哈
[/Qu可以加你qq吗