java spring 报错

wenwen1 发布于 2012/10/10 16:33
阅读 2K+
收藏 0
package net.gvsun.preparation.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
        @NamedQuery(name = "findAllProjects", query = "select myProject from Project myProject"),
        @NamedQuery(name = "findProjectByCreateDate", query = "select myProject from Project myProject where myProject.createDate = ?1"),
        @NamedQuery(name = "findProjectById", query = "select myProject from Project myProject where myProject.id = ?1"),
        @NamedQuery(name = "findProjectByPrimaryKey", query = "select myProject from Project myProject where myProject.id = ?1"),
        @NamedQuery(name = "findProjectByProjectName", query = "select myProject from Project myProject where myProject.projectName = ?1"),
        @NamedQuery(name = "findProjectByProjectNameContaining", query = "select myProject from Project myProject where myProject.projectName like ?1"),
        @NamedQuery(name = "findProjectByProjectNo", query = "select myProject from Project myProject where myProject.projectNo = ?1"),
        @NamedQuery(name = "findProjectByProjectNoContaining", query = "select myProject from Project myProject where myProject.projectNo like ?1"),
        @NamedQuery(name = "findProjectBySpecification", query = "select myProject from Project myProject where myProject.specification = ?1"),
        @NamedQuery(name = "findProjectBySpecificationContaining", query = "select myProject from Project myProject where myProject.specification like ?1") })
@Table(catalog = "pms", name = "project")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "preparation/net/gvsun/preparation/domain", name = "Project")
@XmlRootElement(namespace = "preparation/net/gvsun/preparation/domain")
public class Project implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 项目编号
     *
     */

    @Column(name = "ID", nullable = false)
    @Basic(fetch = FetchType.EAGER)
    @Id
    @XmlElement
    @GeneratedValue(strategy=GenerationType.AUTO)
    Integer id;
    /**
     * 项目名称
     *
     */

    @Column(name = "Project_Name")
    @Basic(fetch = FetchType.EAGER)
    @XmlElement
    String projectName;
    /**
     * 创建日期
     *
     */
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "Create_DATE")
    @Basic(fetch = FetchType.EAGER)
    @XmlElement
    Calendar createDate;
    /**
     * 描述
     *
     */

    @Column(name = "Specification")
    @Basic(fetch = FetchType.EAGER)
    @XmlElement
    String specification;
    /**
     * 项目编号
     *
     */

    @Column(name = "Project_No")
    @Basic(fetch = FetchType.EAGER)
    @XmlElement
    String projectNo;

    /**
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumns({ @JoinColumn(name = "Creater", referencedColumnName = "ID") })
    @XmlTransient
    User userByCreater;
    /**
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumns({ @JoinColumn(name = "Statue_ID", referencedColumnName = "ID") })
    @XmlTransient
    CStatue CStatue;
    /**
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumns({ @JoinColumn(name = "Responser", referencedColumnName = "ID") })
    @XmlTransient
    User userByResponser;
    /**
     */
    @OneToMany(mappedBy = "project", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
    @XmlElement(name = "", namespace = "")
    java.util.Set<net.gvsun.preparation.domain.Task> tasks;
    /**
     */
    @OneToMany(mappedBy = "project", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
    @XmlElement(name = "", namespace = "")
    java.util.Set<net.gvsun.preparation.domain.ProjectApplication> projectApplications;
    /**
     */
    @OneToMany(mappedBy = "project", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
    @XmlElement(name = "", namespace = "")
    java.util.Set<net.gvsun.preparation.domain.ProjectSchedule> projectSchedules;
    /**
     */
    @OneToMany(mappedBy = "project", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
    @XmlElement(name = "", namespace = "")
    java.util.Set<net.gvsun.preparation.domain.Document> documents;
    /**
     */
    @OneToMany(mappedBy = "project", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)
    @XmlElement(name = "", namespace = "")
    java.util.Set<net.gvsun.preparation.domain.ProjectFinance> projectFinances;
    /**
     */
    @OneToOne(mappedBy = "project", fetch = FetchType.LAZY)
    @XmlElement(name = "", namespace = "")
    ProjectArtical projectArtical;

    /**
     * 项目编号
     *
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 项目编号
     *
     */
    public Integer getId() {
        return this.id;
    }

    /**
     * 项目名称
     *
     */
    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    /**
     * 项目名称
     *
     */
    public String getProjectName() {
        return this.projectName;
    }

    /**
     * 创建日期
     *
     */
    public void setCreateDate(Calendar createDate) {
        this.createDate = createDate;
    }

    /**
     * 创建日期
     *
     */
    public Calendar getCreateDate() {
        return this.createDate;
    }

    /**
     * 描述
     *
     */
    public void setSpecification(String specification) {
        this.specification = specification;
    }

    /**
     * 描述
     *
     */
    public String getSpecification() {
        return this.specification;
    }

    /**
     * 项目编号
     *
     */
    public void setProjectNo(String projectNo) {
        this.projectNo = projectNo;
    }

    /**
     * 项目编号
     *
     */
    public String getProjectNo() {
        return this.projectNo;
    }

    /**
     */
    public void setUserByCreater(User userByCreater) {
        this.userByCreater = userByCreater;
    }

    /**
     */
    @JsonIgnore
    public User getUserByCreater() {
        return userByCreater;
    }

    /**
     */
    public void setCStatue(CStatue CStatue) {
        this.CStatue = CStatue;
    }

    /**
     */
    @JsonIgnore
    public CStatue getCStatue() {
        return CStatue;
    }

    /**
     */
    public void setUserByResponser(User userByResponser) {
        this.userByResponser = userByResponser;
    }

    /**
     */
    @JsonIgnore
    public User getUserByResponser() {
        return userByResponser;
    }

    /**
     */
    public void setTasks(Set<Task> tasks) {
        this.tasks = tasks;
    }

    /**
     */
    @JsonIgnore
    public Set<Task> getTasks() {
        if (tasks == null) {
            tasks = new java.util.LinkedHashSet<net.gvsun.preparation.domain.Task>();
        }
        return tasks;
    }

    /**
     */
    public void setProjectApplications(Set<ProjectApplication> projectApplications) {
        this.projectApplications = projectApplications;
    }

    /**
     */
    @JsonIgnore
    public Set<ProjectApplication> getProjectApplications() {
        if (projectApplications == null) {
            projectApplications = new java.util.LinkedHashSet<net.gvsun.preparation.domain.ProjectApplication>();
        }
        return projectApplications;
    }

    /**
     */
    public void setProjectSchedules(Set<ProjectSchedule> projectSchedules) {
        this.projectSchedules = projectSchedules;
    }

    /**
     */
    @JsonIgnore
    public Set<ProjectSchedule> getProjectSchedules() {
        if (projectSchedules == null) {
            projectSchedules = new java.util.LinkedHashSet<net.gvsun.preparation.domain.ProjectSchedule>();
        }
        return projectSchedules;
    }

    /**
     */
    public void setDocuments(Set<Document> documents) {
        this.documents = documents;
    }

    /**
     */
    @JsonIgnore
    public Set<Document> getDocuments() {
        if (documents == null) {
            documents = new java.util.LinkedHashSet<net.gvsun.preparation.domain.Document>();
        }
        return documents;
    }

    /**
     */
    public void setProjectFinances(Set<ProjectFinance> projectFinances) {
        this.projectFinances = projectFinances;
    }

    /**
     */
    @JsonIgnore
    public Set<ProjectFinance> getProjectFinances() {
        if (projectFinances == null) {
            projectFinances = new java.util.LinkedHashSet<net.gvsun.preparation.domain.ProjectFinance>();
        }
        return projectFinances;
    }

    /**
     */
    public void setProjectArtical(ProjectArtical projectArtical) {
        this.projectArtical = projectArtical;
    }

    /**
     */
    @JsonIgnore
    public ProjectArtical getProjectArtical() {
        return projectArtical;
    }

    /**
     */
    public Project() {
    }

    /**
     * Copies the contents of the specified bean into this bean.
     *
     */
    public void copy(Project that) {
        setId(that.getId());
        setProjectName(that.getProjectName());
        setCreateDate(that.getCreateDate());
        setSpecification(that.getSpecification());
        setProjectNo(that.getProjectNo());
        setUserByCreater(that.getUserByCreater());
        setCStatue(that.getCStatue());
        setUserByResponser(that.getUserByResponser());
        setTasks(new java.util.LinkedHashSet<net.gvsun.preparation.domain.Task>(that.getTasks()));
        setProjectApplications(new java.util.LinkedHashSet<net.gvsun.preparation.domain.ProjectApplication>(that.getProjectApplications()));
        setProjectSchedules(new java.util.LinkedHashSet<net.gvsun.preparation.domain.ProjectSchedule>(that.getProjectSchedules()));
        setDocuments(new java.util.LinkedHashSet<net.gvsun.preparation.domain.Document>(that.getDocuments()));
        setProjectFinances(new java.util.LinkedHashSet<net.gvsun.preparation.domain.ProjectFinance>(that.getProjectFinances()));
        setProjectArtical(that.getProjectArtical());
    }

    /**
     * Returns a textual representation of a bean.
     *
     */
    public String toString() {

        StringBuilder buffer = new StringBuilder();

        buffer.append("id=[").append(id).append("] ");
        buffer.append("projectName=[").append(projectName).append("] ");
        buffer.append("createDate=[").append(createDate).append("] ");
        buffer.append("specification=[").append(specification).append("] ");
        buffer.append("projectNo=[").append(projectNo).append("] ");

        return buffer.toString();
    }

    /**
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
        return result;
    }

    /**
     */
    public boolean equals(Object obj) {
        if (obj == this)
            return true;
        if (!(obj instanceof Project))
            return false;
        Project equalCheck = (Project) obj;
        if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
            return false;
        if (id != null && !id.equals(equalCheck.id))
            return false;
        return true;
    }
}

报如下的错:

org.springframework.beans.NotReadablePropertyException: Invalid property 'authority' of bean class [net.gvsun.preparation.domain.Project]: Bean property 'authority' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:729)
    at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:576)
    at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:553)
    at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:719)
    at org.springframework.validation.AbstractPropertyBindingResult.getActualFieldValue(AbstractPropertyBindingResult.java:99)
    at org.springframework.validation.AbstractBindingResult.getFieldValue(AbstractBindingResult.java:219)
    at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:120)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:178)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:198)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:164)
    at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:127)
    at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421)
    at org.springframework.web.servlet.tags.form.SelectTag.writeTagContent(SelectTag.java:199)
    at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    at org.apache.jsp.WEB_002dINF.pages._005fproject.projectApplication_jsp._jspx_meth_form_005fselect_005f4(projectApplication_jsp.java:1216)
    at org.apache.jsp.WEB_002dINF.pages._005fproject.projectApplication_jsp._jspx_meth_form_005fform_005f0(projectApplication_jsp.java:402)
    at org.apache.jsp.WEB_002dINF.pages._005fproject.projectApplication_jsp._jspService(projectApplication_jsp.java:108)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

以下是问题补充:

@wenwen1:其中authority是数据库中一个表 (2012/10/10 16:35)
加载中
0
罪恶的花生
罪恶的花生
org.springframework.beans.NotReadablePropertyException: Invalid property 'authority' of bean class [net.gvsun.preparation.domain.Project]: Bean property 'authority' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
罪恶的花生
罪恶的花生
回复 @wenwen1 : 你的Project里面定义了一个authority的字段,但是没有富裕他get和set方法,或返回的数据类型不匹配。错误描述算够清楚了。
wenwen1
wenwen1
什么啊?
0
恶狼先生

java框架生成,www点javacoder点top,希望各位coder受益1231232

返回顶部
顶部