首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

java.lang.ClassCastException: java.util.HashSet解决方法!

2014-01-26 
客户表,定单表和定单明细表,客户表和定单表单向1对多,定单表和定单明细表1对1....我在添加定单表的时候怎么

客户表,定单表和定单明细表,客户表和定单表单向1对多,定单表和定单明细表1对1....我在添加定单表的时候怎么老是报这个错java.lang.ClassCastException: java.util.HashSet

customer:
public class CusInfo {
private long id;
private String cid;
private String cpwd;
private String csex;
private String caddress;
private Set Order;
public String getCaddress() {
return caddress;
}
public void setCaddress(String caddress) {
this.caddress = caddress;
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getCpwd() {
return cpwd;
}
public void setCpwd(String cpwd) {
this.cpwd = cpwd;
}
public String getCsex() {
return csex;
}
public void setCsex(String csex) {
this.csex = csex;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Set getOrder() {
return Order;
}
public void setOrder(Set order) {
Order = order;
}


}

orderInfo
public class OrderInfo {
private long id;
private String oname;
private CusInfo cus;
private Set myorderdetail;
public Set getMyorderdetail() {
return myorderdetail;
}
public void setMyorderdetail(Set myorderdetail) {
this.myorderdetail = myorderdetail;
}
public CusInfo getCus() {
return cus;
}
public void setCus(CusInfo cus) {
this.cus = cus;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getOname() {
return oname;
}
public void setOname(String oname) {
this.oname = oname;
}

}
orderDetail
public class OrderDetail {
private long id;
private double totalprice;
private long pid;
private OrderInfo myorder;
public long getPid() {
return pid;
}
public void setPid(long pid) {
this.pid = pid;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public double getTotalprice() {
return totalprice;
}
public void setTotalprice(double totalprice) {
this.totalprice = totalprice;
}
public OrderInfo getMyorder() {
return myorder;
}
public void setMyorder(OrderInfo myorder) {
this.myorder = myorder;
}

}

测试用例:
OrderOpraImpl oimpl = (OrderOpraImpl)ctx.getBean( "orderOpra ");
OrderInfo oinfo = new OrderInfo(); //创建order实例         

热点排行