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;
}
}
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;
}
}
相关文章推荐
- 访问Nginx发生SSL connection error的一种情况
- 星外虚拟主机访问被控出现Unspecified error解决方法
- IIS 错误 Server Application Error 详细解决方法
- On Error Resume Next 语句
- IIS运行错误 Server Application Error 错误代码 Error: 8004的解决方法
- Lua编程示例(一):select、debug、可变参数、table操作、error
- 收集整理的http/1.1 500 server error错误的解决方法
- SQL 2005 ERROR:3145 解决办法(备份集中的数据库备份与现有的数据库不同)
- VBScript中On Error语句用法小结
- 解决VC++编译报错error C2248的方案
- JQuery ajax中error返回错误及一直返回error的解答
- PHP函数之error_reporting(E_ALL ^ E_NOTICE)详细说明
- node.js使用npm 安装插件时提示install Error: ENOENT报错的解决方法
- Hibernate Oracle sequence的使用技巧
- jsp Hibernate批量更新和批量删除处理代码
- jsp hibernate的分页代码第1/3页
- JAVA+Hibernate 无限级分类
- SSH整合中 hibernate托管给Spring得到SessionFactory
- jsp hibernate 数据保存操作的原理
- PHP 5.3和PHP 5.4出现FastCGI Error解决方法