gpt4 book ai didi

java - 尽管类别正确,为什么会出现此错误?

转载 作者:行者123 更新时间:2023-12-02 02:19:12 25 4
gpt4 key购买 nike

这是错误消息:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'nWriteDate' of 'class com.tj.notice.model.Notice1' with value '2018-02-12 15:17:54.0' Cause: org.apache.ibatis.reflection.ReflectionException: There is no setter for property named 'nWriteDate' in 'class com.tj.notice.model.Notice1'

Notice1:

package com.tj.notice.model;

import java.sql.Timestamp;

public class Notice1 {

private int nIdx;
private String aID;
private String nTitle;
private String nContent;
private Timestamp nWritedate;
private int startRow;
private int endRow;
public int getnIdx() {
return nIdx;
}
public void setnIdx(int nIdx) {
this.nIdx = nIdx;
}
public String getaID() {
return aID;
}
public void setaID(String aID) {
this.aID = aID;
}
public String getnTitle() {
return nTitle;
}
public void setnTitle(String nTitle) {
this.nTitle = nTitle;
}
public String getnContent() {
return nContent;
}
public void setnContent(String nContent) {
this.nContent = nContent;
}
public Timestamp getnWritedate() {
return nWritedate;
}
public void setnWritedate(Timestamp nWritedate) {
this.nWritedate = nWritedate;
}
public int getStartRow() {
return startRow;
}
public void setStartRow(int startRow) {
this.startRow = startRow;
}
public int getEndRow() {
return endRow;
}
public void setEndRow(int endRow) {
this.endRow = endRow;
}
}

尽管类正确,为什么会出现此错误?

最佳答案

当你遇到异常时,要有耐心。它说“‘class com.tj.notice.model.Notice1’中没有名为‘nWriteDate’的属性的 setter ”。

你需要改变

public Timestamp getnWritedate() {
return nWritedate;
}
public void setnWritedate(Timestamp nWritedate) {
this.nWritedate = nWritedate;
}

public Timestamp getNWritedate() {
return nWritedate;
}
public void setNWritedate(Timestamp nWritedate) {
this.nWritedate = nWritedate;
}

通常可以通过 IDE(例如 eclipse、intellij)生成 getter 和 setter 来避免此类错误。

关于java - 尽管类别正确,为什么会出现此错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48763331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com