1,出现问题的语句:
String str = new String("最新图书");
SectionInfo newBook = (SectionInfo)sectionDao.findBySection(str);
2,调用的方法:
public List findBySection(Object section) {
return findByProperty(SECTION, section);
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding SectionInfo instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from SectionInfo as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
3,出现的异常:
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ClassCastException: java.util.ArrayList
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
4,求解?
String str = new String("最新图书");
SectionInfo newBook = (SectionInfo)sectionDao.findBySection(str);
2,调用的方法:
public List findBySection(Object section) {
return findByProperty(SECTION, section);
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding SectionInfo instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from SectionInfo as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString);
queryObject.setParameter(0, value);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
3,出现的异常:
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ClassCastException: java.util.ArrayList
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
4,求解?
解决方案 »
- ireport打印机自定义纸张高度问题
- 页面为什么不跳转?
- Eclipse下怎么配置Tomcat自动编译JAVA类文件
- 这个功能怎么实现?
- ===============又来一新问题!大家来帮帮我!欢迎大家讨论=====================================================
- !!200分求教!!在showModelessDialog窗口中open一个新窗口时会删除session么??在线等....
- Tomcat中的一个问题
- HttpClient 需要的jar包谁给份啊 谢谢各位大神了啊
- 关于传值
- 站点发布如何手动设置?
- (在线等!!!)求救:FCKeditor 浏缆带中文文件名的文件链接时出现乱码,不能打开?
- 有关hibernater的一点疑问
获取的时候应该用一个List
List<SectionInfo> newBook = sectionDao.findBySection(str); SectionInfo sectionInfo = newBook.get(0);
第一次提问,这么快得到正确答复,谢谢。