Exception in thread "main" org.hibernate.PropertyAccessException:
IllegalArgumentExceptionoccurredwhilecallingsetterofcom.pinjia.hibernate.model.Users....
IllegalArgumentException occurred while calling setter of com.pinjia.hibernate.model.Users.address 这个是什么问题 。求大神帮忙看看!为什么老是说参数类型不匹配。但是我检查了好久没发现啊
展开
1个回答
2015-01-22
展开全部
在java编程的时候经常出现如题所示的错误,在网上有很多解决方法,归根到底都是classpath设置错误或者class文件的不正确存放造成的,今天我就遇到了这个问题:
package me.Person;
public class Person {
private String name;
private int age;
private String address;
//应该避免实用public属性,使用设置器和获取器修改对象属性
//public String name;
//public int age;
//public String address;
public Person(){
name = "Dandan";
age = 25;
address = "SD";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
//this.age = age;
if((age <= 0)||(age >= 120)){
this.age = -1;
}else
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
package me.Person;
public class Person {
private String name;
private int age;
private String address;
//应该避免实用public属性,使用设置器和获取器修改对象属性
//public String name;
//public int age;
//public String address;
public Person(){
name = "Dandan";
age = 25;
address = "SD";
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
//this.age = age;
if((age <= 0)||(age >= 120)){
this.age = -1;
}else
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询