您的位置:首页 > 运维架构

org.hibernate.PropertyAccessException: Exception occurred inside getter of ******——【hibernate 日常错误】

2015-12-06 20:47 741 查看
En:org.hibernate.PropertyAccessException: Exception occurred inside getter
of org.enva.pojo.Person.password

错误原因:Person 实体类中的password属性的setting/getting方法同password的类型不匹配  以下便是错误示例:【错误位置由红色标出】

package org.enva.pojo;

import java.util.Date;

/**

 * 持久化类设计

 * 注意:

 *     持久化类通常建议有一个持久化标识符(ID)

 *  持久化标识符通常建议使用 封装类(基本类型有默认值)

 *  持久化类通常建议手动给定一个无参构造器(因为有一些操作,是反射进行的)

 *  属性通常建议提供 getting/setting方法

 *  持久化类不能是final

 *  持久化类中如果使用了集合类型数据,只能用接口类型进行申明(List/Set/Map)

 *  List list=new ArrayList();

 * @author Administrator

 * @file Person.java

 * @date 2015年12月3日

 * @action

 */

public class Person {

    private Integer id;

    private String name;

    private Integer password;

    private Date birthday;

    public Person(){}

    public Person(String name, int password, Date birthday) {

        super();

        this.name = name;

        this.password = password;

        this.birthday = birthday;

    }

    @Override

    public String toString() {

        return "Person [id=" + id + ", name=" + name + ", password=" + password + ", birthday=" + birthday + "]";

    }

    public Integer getId() {

        return id;

    }

    public void setId(Integer id) {

        this.id = id;

    }

    public String getName() {

        return name;

    }

    public void setName(String name) {

        this.name = name;

    }
    public int getPassword() {

        return password;

    }

    public void setPassword(int password) {

        this.password = password;

    }

    public Date getBirthday() {

        return birthday;

    }

    public void setBirthday(Date birthday) {

        this.birthday = birthday;

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  hibernate error