我创建了一个休眠程序并编写了一个查询并得到以下错误:
我有一个例外说明java.lang.ClassCastException: java.lang.Double
String qry="Select Distinct (s2Taxper) from S2 where s2Tc='601' AND s2Txcd!=''";
Iterator atItr2=hbSession.createQuery(qry).iterate();
String qry1="Select ahCode,ahName,ahRcNumber,ahCentralSalesTaxNumber From AccountHeader ORDER BY ahName ASC";
Iterator atItr1=hbSession.createQuery(qry1).iterate();
mainBean=new VatMainBean();
VatSubBeanList=new ArrayList<VatSubBean>();
while(atItr1.hasNext()){
subBean=new VatSubBean();
Object[] obj1=(Object[])atItr1.next();
String ahCode =(String)obj1[0];
String ahName =(String)obj1[1];
String ahRcNumber=(String)obj1[2];
String ahCentralSalesTaxNumber=(String)obj1[3];
if("v".equalsIgnoreCase(type)){
if(ahRcNumber!=null&&!"".equalsIgnoreCase(ahRcNumber)){
if(ahRcNumber.indexOf("/")<0&&ahRcNumber.indexOf(":")<0&&ahRcNumber.indexOf(" ")<0){
//buyersTinNo.trim();
if(ahRcNumber.length()==11){
buyersTinNo=ahRcNumber;
}
}
}
}
else{
if(ahCentralSalesTaxNumber!=null&&!"".equalsIgnoreCase(ahCentralSalesTaxNumber)){
buyersTinNo=ahCentralSalesTaxNumber;
}
}
DoubleCheck doubleObj1=new DoubleCheck();
List<String> taxPerList=new ArrayList<String>();
int i = 0;
while (atItr2.hasNext()){
Object[] obj2=(Object[])atItr2.next();// error is shown here
String s2Taxper=(String)obj2[0];
int s1Docno=(Integer)obj2[1];
if(Double.parseDouble(s2Taxper)>0){
taxPerList.add(s2Taxper);
}
我该如何纠正?