net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of mypack.Customers.setTotalPrice这是报的异常!
一。我的Customers表的字段:
ID bigint not null
TYPE varchar(15)
TYPE_KEY varchar(15)
VALUE varchar(128),
二。持久化类AbstractCustomers
public abstract class AbstractCustomers
implements Serializable
{
……
private double avgPrice;
private double totalPrice;
public AbstractCustomers()
{
}
public AbstractCustomers(String firstname,String lastname,String sex,Set orders,String customerDescription){
this.firstname=firstname;
this.lastname=lastname;
this.sex=sex;
this.orders=orders;
this.customerDescription=customerDescription;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getName(){
return firstname+ " "+lastname;
}
public void setName(String name){
StringTokenizer t=new StringTokenizer(name);
firstname=t.nextToken();
lastname=t.nextToken();
}
public Set getOrders() {
return orders;
}
public void setOrders(Set orders) {
this.orders = orders;
calculatePrice();
}
public double getAvgPrice() {
return avgPrice;
}
public void setAvgPrice(double avgPrice) {
this.avgPrice = avgPrice;
}
public double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(double totalPrice) {
this.totalPrice = totalPrice;
}
private void calculatePrice(){
double avgPrice = 0.0;
double totalPrice = 0.0;
int count=0;
if ( getOrders() != null ){
Iterator iter = getOrders().iterator();
while( iter.hasNext() ){
double orderPrice = ((Orders)iter.next()).getPrice();
totalPrice += orderPrice;