springMVC 实体映射问题

/**
*这里是表的结构
*/

CREATE TABLE "PS"."U_BILL" (
"ID" NUMBER(11) NOT NULL ,
"BILL_NUM" VARCHAR2(16 CHAR) NULL ,
"BILL_STATUS" VARCHAR2(8 CHAR) NULL ,
"PAY_BACK_DATE" DATE NULL ,
"PAY_BACK_TIME" VARCHAR2(16 CHAR) NULL ,
"PAY_MONEY" NUMBER(25,10) NULL ,
"PAYGROUP_ID" NUMBER(25,10) NULL ,
"UUID" VARCHAR2(64 CHAR) NULL ,
"WHOCREATED" VARCHAR2(100 CHAR) NULL ,
"WHENCREATED" TIMESTAMP(6) DEFAULT SYSDATE NULL ,
"WHOMODIFIED" VARCHAR2(100 CHAR) NULL ,
"WHENMODIFIED" TIMESTAMP(6) NULL
)
LOGGING
NOCOMPRESS
NOCACHE

;

/**
*这是我的实体类代码
*/
package com.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**

  • U_BILL Entity @author sjy
    */
    @Entity
    @Table(name = "U_BILL", schema = "PS")
    public class TUBill {

    private BigDecimal id;
    private String billNum;
    private String billStatus;
    private Date payBackDate;
    private double payMoney;
    private BigDecimal paygroupId;
    private String uuid;

    // Constructors

    /** default constructor */

    public TUBill() {
    super();
    }

    /** full constructor */

    public TUBill(BigDecimal id, String billNum, String billStatus,
    Date payBackDate, double payMoney, BigDecimal paygroupId,
    String uuid) {
    super();
    this.id = id;
    this.billNum = billNum;
    this.billStatus = billStatus;
    this.payBackDate = payBackDate;
    this.payMoney = payMoney;
    this.paygroupId = paygroupId;
    this.uuid = uuid;
    }

    // Property accessors

    @Id
    @Column(name = "ID", unique = true, nullable = false, precision = 11, scale = 0)
    public BigDecimal getId() {
    return id;
    }

    public void setId(BigDecimal id) {
    this.id = id;
    }

    @Column(name = "BILL_NUM", length = 16)
    public String getBillNum() {
    return billNum;
    }

    public void setBillNum(String billNum) {
    this.billNum = billNum;
    }

    @Column(name = "BILL_STATUS", length = 8)
    public String getBillStatus() {
    return billStatus;
    }

    public void setBillStatus(String billStatus) {
    this.billStatus = billStatus;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "PAY_BACK_DATE", length = 7)
    public Date getPayBackDate() {
    return payBackDate;
    }

    public void setPayBackDate(Date payBackDate) {
    this.payBackDate = payBackDate;
    }

    @Column(name = "PAY_MONEY", precision = 25, scale = 10)
    public double getPayMoney() {
    return payMoney;
    }

    public void setPayMoney(double payMoney) {
    this.payMoney = payMoney;
    }

    @Column(name = "PAYGROUP_ID", precision = 25, scale = 10)
    public BigDecimal getPayGroupid() {
    return paygroupId;
    }

    public void setPayGroupid(BigDecimal paygroupId) {
    this.paygroupId = paygroupId;
    }

    @Column(name = "UUID", length = 64)
    public String getUuid() {
    return uuid;
    }

    public void setUuid(String uuid) {
    this.uuid = uuid;
    }

}

请教各位大神,,我运行时候报错
org.springframework.orm.hibernate4.HibernateQueryException: could not resolve property: paygroupId of: com.entity.TUBill; nested exception is org.hibernate.QueryException: could not resolve property: paygroupId of: com.entity.TUBill

这个是因为我实体映射写错了吗?还是因为数据库中的类型和实体里面的类型没匹配上?这个怎么解决啊,求指教啊~~~~~~

3个回答

BigDecimal 改成double试试

Evankaka
Evankaka 回复qq_24833697: 看到了,确实 要很细心!
大约 5 年之前 回复
qq_24833697
我是一个小黄瓜 这个我试过改成double,Double Integer int 都没效果的T_T
大约 5 年之前 回复

啊啊啊啊,我问题解决了,折磨我一天一夜的问题啊,
解决方法:::
大家注意了,我自己粗心,感觉payGroupId这个写法不好,改成了paygroupId,那么问题来了,这样写可以,但是他的getter和setter方法是第一次自动生成的,当该了属性名的时候,报错的几个地方改好了,!!!(关键是方法名那个地方没报错,所以没改,然后出现异常了,)

切记切记,getter和setter的方法名也要改好。
我这个错误犯的太低级了 ~~~
最后谢谢各位的耐心解答!!
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐