各位网友,看到标题不要喷我啊。
开始需要这个问题,在网上搜索了一圈,都说参数中有NULL值。
我是用spring MVC插入一个对象,原来的表结构中有个字段是number类型,我hibernate配置文件配置的int
在插入工程中打印对象,对象只有一个值没有(这个值时默认的数据sysdate)。插入是,报这个错。后面我实在不知道什么原因,直接修改表结构。把number改成varchar2了,配置文件陪的string。
结果插入时,还报这个错。各位大侠们,求解释、意见啊。

解决方案 »

  1.   


                    //封装要保存的类
                    TcomplainRecord record = new TcomplainRecord();
    record.setId(UUIDUtil.createID());
    record.setReporterId(cn);
    record.setReporterName(name);
    record.setProcessState('0');
    record.setIsAlert('0');
    record.setModelFlag('0');
    record.setReportTime(DateUtil.getTimestamp(new Date()));
    record.setTitle(title);
    record.setContent(content);
    record.setDeptid(deptid);


    complainService.saveComplain(record);
    配置文件
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- Generated 2012-7-25 14:13:48 by Hibernate Tools 3.3.0.GA -->
    <hibernate-mapping>
        <class name="com.haier.portal.model.psicomplain.persistent.entity.TcomplainRecord" table="TCOMPLAIN_RECORD">
            <id name="id" type="string">
                <column name="ID" length="32" />
                <generator class="uuid.hex" />
            </id>
            <property name="deptid" type="string">
                <column name="DEPTID" length="5" />
            </property>
            <property name="reporterId" type="string">
                <column name="REPORTER_ID" length="60" />
            </property>
            <property name="reporterName" type="string">
                <column name="REPORTER_NAME" length="60" />
            </property>
            <property name="title" type="string">
                <column name="TITLE" length="200" />
            </property>
            <property name="content" type="string">
                <column name="CONTENT" length="2000" />
            </property>
            <property name="reportTime" type="serializable">
                <column name="REPORT_TIME" />
            </property>
            <property name="processState" type="java.lang.Character">
                <column name="PROCESS_STATE" length="1" />
            </property>
            <property name="modelFlag" type="java.lang.Character">
                <column name="MODEL_FLAG" length="1" />
            </property>
            <property name="processTime" type="serializable">
                <column name="PROCESS_TIME" />
            </property>
            <property name="isAlert" type="java.lang.Character">
                <column name="IS_ALERT" length="1" />
            </property>
            <set name="tcomplainResults" table="TCOMPLAIN_RESULT" inverse="true" lazy="true" fetch="select">
                <key>
                    <column name="CP_ID" length="32" />
                </key>
                <one-to-many class="com.haier.portal.model.psicomplain.persistent.entity.TcomplainResult" />
            </set>
            <set name="tcomplainAttachments" table="TCOMPLAIN_ATTACHMENT" inverse="true" lazy="true" fetch="select">
                <key>
                    <column name="CP_ID" length="32" />
                </key>
                <one-to-many class="com.haier.portal.model.psicomplain.persistent.entity.TcomplainAttachment" />
            </set>
        </class>
    </hibernate-mapping>实体类private String id;
    private String deptid;
    private String reporterId;
    private String reporterName;
    private String title;
    private String content;
    private Serializable reportTime;
    private Character processState;
    private Character modelFlag;
    private Serializable processTime;
    private Character isAlert;
    private Set tcomplainResults = new HashSet(0);
    private Set tcomplainAttachments = new HashSet(0); public TcomplainRecord() {
    } public TcomplainRecord(String id) {
    this.id = id;
    } public TcomplainRecord(String id,String deptid, TcomplainDepartment tcomplainDepartment,
    String reporterId, String reporterName, String title,
    String content, Serializable reportTime, Character processState,
    Character modelFlag, Serializable processTime, Character isAlert,
    Set tcomplainResults, Set tcomplainAttachments) {
    this.id = id;
    this.deptid = deptid;
    this.reporterId = reporterId;
    this.reporterName = reporterName;
    this.title = title;
    this.content = content;
    this.reportTime = reportTime;
    this.processState = processState;
    this.modelFlag = modelFlag;
    this.processTime = processTime;
    this.isAlert = isAlert;
    this.tcomplainResults = tcomplainResults;
    this.tcomplainAttachments = tcomplainAttachments;
    }