Oracle问题 急急!!!!

下面是我写的dao类里的方法:public String findMaxEndNum(String areaNo, Integer cardTypeId){  String endNumResult = "";  String hql = "select MAX(Cast(cardApply.endNum AS Integer)) from CardApply as cardApply " + "where cardApply.areaNo = '"+areaNo+"' and cardApply.cardTypeId='"+cardTypeId+"'";  List list = this.queryByHQL(hql);  System.out.println(list.get(0));  if(list!=null&&list.size()>0){   endNumResult = (String)list.get(0);   System.out.println(endNumResult);  }  return endNumResult; }下面是调用这个方法报的错2010-11-23 06:01:30,204 ERROR (StandardWrapperValve.java:253) - Servlet.service() for servlet action threw exceptionjava.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.AggregateNode  \-[AGGREGATE] AggregateNode: 'MAX'    \-[METHOD_CALL] MethodNode: '('       +-[METHOD_NAME] IdentNode: 'Cast' {originalText=Cast}       \-[EXPR_LIST] SqlNode: 'exprList'          +-[DOT] DotNode: 'cardapply0_.EndNum' {propertyName=endNum,dereferenceType=4,propertyPath=endNum,path=cardApply.endNum,tableAlias=cardapply0_,className=cn.eainfo.com.card.po.CardApply,classAlias=cardApply}          |  +-[ALIAS_REF] IdentNode: 'cardapply0_.ApplyID' {alias=cardApply, className=cn.eainfo.com.card.po.CardApply, tableAlias=cardapply0_}          |  \-[IDENT] IdentNode: 'endNum' {originalText=endNum}          \-[IDENT] IdentNode: 'Integer' {originalText=Integer}  

第1个回答  2011-11-16
看了没错啊,建议用debug跟踪,一下看哪里出错了。可能跟数据类型转换有关。
把你代码复制遍方便别人看哈
public String findMaxEndNum(String areaNo, Integer cardTypeId)
{ String endNumResult = "";
String hql = "select MAX(Cast(cardApply.endNum AS Integer)) from
CardApply cardApply " + "where cardApply.areaNo = '"+areaNo+"'
and cardApply.cardTypeId='"+cardTypeId+"'";
List list = this.queryByHQL(hql);
System.out.println(list.get(0));
if(list!=null&&list.size()>0){
endNumResult = (String)list.get(0);
System.out.println(endNumResult);
}
return endNumResult;
}
第2个回答  2011-11-16
哥们,能不能把代码规范下呢,这样看起来实在是有点费劲哈
第3个回答  2011-11-16
好怕人 我不会
相似回答