+ "KmsAddresslist as a where c.kmsUser.userId=a.kmsUser.userId and c.findId='"
+ questionId
+ "' and a.isExpert=0 order by Convert(varchar,answerTime,111) desc ";
我研究了很时间,也没有发现它的错误。
编译器报的异常:
at org.ks.hulu.disdaoimpl.DisDaoImpl.listuserreply(DisDaoImpl.java:186)
at com.yourcompany.struts.action.QueryQuestionAction.execute(QueryQuestionAction.java:64)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
这是程序的相关代码:
/**
* 查询指定问题的全部回复(全员讨论)
*
*/
public List listuserreply(int questionId, int commentsType) {
List<KmsComments> userlist = new ArrayList<KmsComments>();
List list = null;
String hql = "";
try {
switch (commentsType) {
// 创建hql语句,条件:isExpert=0
case 0:
// 知识评论
hql = "";
break;
case 1:
// 全员回复
System.out.println("进入case:1");
hql = "from KmsComments as c , "
+ "KmsAddresslist as a where c.kmsUser.userId=a.kmsUser.userId and c.findId='"
+ questionId
+ "' and a.isExpert=0 order by Convert(varchar,answerTime,111) desc ";
break;
case 2:
// 课题回复
hql = "";
break;
case 3:
// 我的学习心得
hql = "";
break;
default:
break;
}
// 执行:查询
list = this.session.createQuery(hql).list();
System.out.println("enter list");
for (java.util.Iterator iter = list.iterator(); iter.hasNext();) {
KmsComments commbean = (KmsComments) iter.next();
// 增加实体对象
userlist.add(commbean);
//=======test==========
System.out.println(commbean.getAnswer());
//======================
}
} catch (Exception ex) {
ex.printStackTrace();
}
return userlist;
}
[此贴子已经被作者于2007-8-13 17:20:28编辑过]