/**
 * 查询课程信息根据课程负责人ID
 */
public CourseInfo findCourseInfoById(int courseFzrId) throws DaoException {
StringBuffer sbf = new StringBuffer();
sbf.append("select a.course_id, a.course_name,") 
   .append("a.course_level as course_level_id, a.course_category as course_category_id, a.department_id ,") 
   .append("a.re_course_cateory as de_course_category_id, a.teaching_object, a.daclare_date,") 
   .append("a.url, a.school_year_tc_no,b.name as course_level_name,c.name as course_category_name,d.department_name,")  
.append("e.name as de_course_cateory_name from t_course_basic_info a,t_data_dict b,t_data_dict c,t_department d,")
.append("t_data_dict e where a.course_level = b.id and a.course_category = c.id and a.department_id = d.department_id and a.re_course_cateory = e.id and a.course__fz_id = ?");
Connection conn = null;
PreparedStatement pstms = null;
ResultSet rs = null;
CourseInfo courseInfo = null;
try{
conn = ConnectionManager.getConnection();
pstms = conn.prepareStatement(sbf.toString());
pstms.setInt(1, courseFzrId);
rs = pstms.executeQuery();

if(rs.next()){
courseInfo = new CourseInfo();
courseInfo.setCourseId(rs.getInt("course_id"));
courseInfo.setCourseName(rs.getString("course_name"));

/*User user = new User();
user.setUserId(rs.getInt("course__fz_id"));
courseInfo.setCourseFzrId(user);*/

CourseLevel courseLevel = new CourseLevel();
courseLevel.setId(rs.getString("course_level_id"));
courseLevel.setName(rs.getString("course_level_name"));
courseInfo.setCourseLevel(courseLevel);

CourseCategory courseCategory = new CourseCategory();
courseCategory.setId(rs.getString("course_category_id"));
courseCategory.setName(rs.getString("course_category_name"));
courseInfo.setCourseCategory(courseCategory);

Department department = new Department();
department.setDepartmentId(rs.getString("department_id"));
department.setDepartmentName(rs.getString("department_name"));
courseInfo.setDepartmentId(department);

DeclareCourseCategory declareCourseCategory = new DeclareCourseCategory();
declareCourseCategory.setId(rs.getString("de_course_category_id"));
declareCourseCategory.setName(rs.getString("de_course_cateory_name"));
courseInfo.setDeclareCourseCategory(declareCourseCategory);

courseInfo.setTeachObject(rs.getString("teaching_object"));
courseInfo.setDeclareDate(rs.getTimestamp("daclare_date"));
courseInfo.setURL(rs.getString("url"));
courseInfo.setTeachNo(rs.getInt("teaching_object"));
return courseInfo;
}
}catch(SQLException e) {
e.printStackTrace();
throw new DaoException("课程基本信息查询失败!");
}finally{
ConnectionManager.close(rs);
ConnectionManager.close(pstms);
}

return courseInfo;
}java.sql.SQLException: 无法转换为内部表示
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.CharCommonAccessor.getInt(CharCommonAccessor.java:132)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:521)
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1563)
at com.usth.qpf.infotemplet.dao.impl.CourseInfoDaoImpl.findCourseInfoById(CourseInfoDaoImpl.java:117)
at com.usth.qpf.infotemplet.services.CourseBasicInfService.findCourseInfoById(CourseBasicInfService.java:59)
at com.usth.qpf.infotemplet.web.action.CourseInfoAction.showModify(CourseInfoAction.java:151)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.usth.qpf.commons.filter.EncodingFilter.doFilter(EncodingFilter.java:26)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)我的推断可能是courseInfo.setDeclareDate(rs.getTimestamp("daclare_date"));
这句代码是不是要进行日期转换,但我没找到答案,请给位高手帮小弟解决一下;

解决方案 »

  1.   

    com.usth.qpf.infotemplet.dao.impl.CourseInfoDaoImpl.findCourseInfoById(CourseInfoDaoImpl.java:117)是哪行??
      

  2.   

    com.usth.qpf.infotemplet.dao.impl.CourseInfoDaoImpl.findCourseInfoById(CourseInfoDaoImpl.java  :  117是那行??
      

  3.   

    courseInfo.setTeachNo(rs.getInt("teaching_object"));
    是这一行,谢谢你,问刚看了你的提示解决啦,我的字段写错啦,
    应该是这样的
    courseInfo.setTeachNo(rs.getInt("school_year_tc_no"));
    我万分感谢你朋友,这个错误我调了一上午啦,你的提示让我在一分钟后解决啦,
    谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!
    谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!谢谢!