BunkNo 这个属性是不是 int BunkNo ;换成 Integer BunkNo ;还有这一行,这样改就可以了 <property column="BunkNo" length="4" name="bunkNo" 
                     not-null="true"type="java.lang.Integer"/>

解决方案 »

  1.   

    BunkNo这个字段在数据库表里是number(4,0),我用的是oracle数据库,另外
    com.ems.bean.ReqIn:package com.ems.bean;import java.io.Serializable;
    import org.apache.commons.lang.builder.ToStringBuilder;public class ReqIn implements Serializable {    /** identifier field */
        private Long id;    /** persistent field */
        private String reqCode;    /** persistent field */
        private String workNo;
        
        /** persistent field */
        private String cnName;
        
        /** persistent field */
        private String conCode;
        
        /** persistent field */
        private String ordCode;
        
        /** persistent field */
        private String supplierName;
        
        /** persistent field */
        private String deptName;
        
        /** persistent field */
        private String carrierName;
        
        /** persistent field */
        private String shipNo;
        
        /** persistent field */
        private String craneNo;
        
        /** persistent field */
        private String scales;
        
        /** persistent field */
        private String depotIn;
        
        /** persistent field */
        private String mask;
        
        /** persistent field */
        private int bunkNo;
        
        /** persistent field */
        private Long matId;
        
        /** persistent field */
        private long dateTime;
        
        /** persistent field */
        private double netValue;
        
        /** persistent field */
        private double percent;
        
        /** persistent field */
        private int printTimes;
        
        /** persistent field */
        private int amount;
        
        /** persistent field */
        private String matName;
        
        private String code;
        
        /** identifier field */
        private Long codeId;
        
        /** persistent field */
        private String type;
        
        /** persistent field */
        private double weight;    public ReqIn(String reqCode, String workNo, String cnName, String conCode, String ordCode, String supplierName, String deptName, String carrierName, String shipNo, String craneNo, String scales, String depotIn, String mask, int bunkNo, double netValue, Long matId, long dateTime, double percent, int printTimes, int amount, String matName, String code, Long codeId, String type, double weight) {
            this.reqCode = reqCode;
            this.workNo = workNo;
            this.cnName = cnName;
            this.conCode = conCode;
            this.ordCode = ordCode;
            this.supplierName = supplierName;
            this.deptName = deptName;
            this.carrierName = carrierName;
            this.shipNo = shipNo;
            this.craneNo = craneNo;
            this.scales = scales;
            this.depotIn = depotIn;
            this.mask = mask;
            this.bunkNo = bunkNo;
            this.netValue = netValue;
            this.matId = matId;
            this.dateTime = dateTime;
            this.percent = percent;
            this.printTimes = printTimes;
            this.amount = amount;
            this.matName = matName;
            this.code = code;
            this.codeId = codeId;
            this.type = type;
            this.weight = weight;
        }    public ReqIn() {
        }    public Long getId() {
            return this.id;
        }    public void setId(Long id) {
            this.id = id;
        }
        
        public int getAmount() {
            return this.amount;
        }    public void setAmount(int amount) {
            this.amount = amount;
        }
        
        public String getMatName() {
            return this.matName;
        }    public void setMatName(String matName) {
            this.matName = matName;
        }
        
        public String getCode() {
            return this.code;
        }    public void setCode(String code) {
            this.code = code;
        }
        
        public Long getCodeId() {
            return this.codeId;
        }    public void setCodeId(Long codeId) {
            this.codeId = codeId;
        }
        
        public String getType() {
            return this.type;
        }    public void setType(String type) {
            this.type = type;
        }
        
        public double getWeight() {
            return this.weight;
        }    public void setWeight(double weight) {
            this.weight = weight;
        }    public String getReqCode() {
            return this.reqCode;
        }    public void setReqCode(String reqCode) {
            this.reqCode = reqCode;
        }    public String getWorkNo() {
            return this.workNo;
        }    public void setWorkNo(String workNo) {
            this.workNo = workNo;
        }
        
        public String getCnName() {
            return this.cnName;
        }    public void setCnName(String cnName) {
            this.cnName = cnName;
        }    public String getConCode() {
            return this.conCode;
        }    public void setConCode(String conCode) {
            this.conCode = conCode;
        }
        
        public String getOrdCode() {
            return this.ordCode;
        }    public void setOrdCode(String ordCode) {
            this.ordCode = ordCode;
        }
        
        public String getSupplierName() {
            return this.supplierName;
        }    public void setSupplierName(String supplierName) {
            this.supplierName = supplierName;
        }
        
        public String getDeptName() {
            return this.deptName;
        }    public void setDeptName(String deptName) {
            this.deptName = deptName;
        }
        
        public String getCarrierName() {
            return this.carrierName;
        }    public void setCarrierName(String carrierName) {
            this.carrierName = carrierName;
        }
        
        public String getShipNo() {
            return this.shipNo;
        }    public void setShipNo(String shipNo) {
            this.shipNo = shipNo;
        }    public String getCraneNo() {
            return this.craneNo;
        }    public void setCraneNo(String craneNo) {
            this.craneNo = craneNo;
        }
        
        public String getScales() {
            return this.scales;
        }    public void setScales(String scales) {
            this.scales = scales;
        }
        
        public String getDepotIn() {
            return this.depotIn;
        }    public void setDepotIn(String depotIn) {
            this.depotIn = depotIn;
        }
        
        public String getMask() {
            return this.mask;
        }    public void setMask(String mask) {
            this.mask = mask;
        }    public int getBunkNo() {
            return this.bunkNo;
        }    public void setBunkNo(int bunkNo) {
            this.bunkNo = bunkNo;
        }    public Long getMatId() {
            return this.matId;
        }    public void setMatId(Long matId) {
            this.matId = matId;
        }
        
        public long getDateTime() {
            return this.dateTime;
        }    public void setDateTime(long dateTime) {
            this.dateTime = dateTime;
        }
        
        public double getNetValue() {
            return this.netValue;
        }    public void setNetValue(double netValue) {
            this.netValue = netValue;
        }
        
        public double getPercent() {
            return this.percent;
        }    public void setPercent(double percent) {
            this.percent = percent;
        }
        
        public int getPrintTimes() {
            return this.printTimes;
        }    public void setPrintTimes(int printTimes) {
            this.printTimes = printTimes;
        }    public String toString() {
            return new ToStringBuilder(this)
                .append("id", getId())
                .toString();
        }}
      

  2.   

    还有不止int BunkNo这个字段出现这个问题,还有Amount,Weight,WorkNo都出过同样的问题,Amount在数据库表里是number(19,0),Weight在数据库表里是number(19,3),WorkNo在数据库表里是Varchar2(10),amount在java里也是int型,倒是可以改成integer了,但weight在java里是double型,workNo是string型呀,那怎么办?究竟怎么回事会发生这种错误呢?
      

  3.   


    double 改成 Double 你要把数据库字段的格式与类属性格式改成一致
      

  4.   

    可是oralce里数字都是用number表示的,我怎么一致?还有workNo是string型,怎么办?
      

  5.   

    number不就是整数workNo就换成数字啊