Hi,
I'm working with the PetClinic demo which comes with Spring.
I thought I'd make some changes to it so I could learn how it works, but have come up against some difficulties.
I decided to allow Vets (instead of just Owners) to have Pets.
vets(id[s], firstName, lastName[/s])
(with the restriction that vets.id must be from owners.id - owners should now be 'people')
Anyway, I have tried replacing the previous
return getHibernateTemplate().find("from Vet vet order by vet.lastName, vet.firstName");
with
return getHibernateTemplate().find("from Vet vet, Owner owner where vet.id = owner.id");
which doesn't in itself return errors, but it does seem to lead to errors.
The errors are below, but seem to imply that the returned results is a set of owners not vets. (suggesting that my HQL is duff).
I understand that I haven't included much, but as a newbie it is hard knowing what's relevant.
Any help/suggestions/questions are very much appreciated.
Full stack trace of any exception that occurs:
javax.servlet.jsp.JspException: An error occurred while evaluating custom action attribute "value" with value "${vet.firstName}": The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer. (null) at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:109) at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129) at org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75) at org.apache.taglibs.standard.tag.el.core.ExpressionUtil.evalNotNull(ExpressionUtil.java:48) at org.apache.taglibs.standard.tag.el.core.OutTag.evaluateExpressions(OutTag.java:99) at org.apache.taglibs.standard.tag.el.core.OutTag.doStartTag(OutTag.java:57) at org.apache.jsp.WEB_002dINF.jsp.vets_jsp._jspx_meth_c_out_0(vets_jsp.java:192) at org.apache.jsp.WEB_002dINF.jsp.vets_jsp._jspx_meth_c_forEach_0(vets_jsp.java:147) at org.apache.jsp.WEB_002dINF.jsp.vets_jsp._jspService(vets_jsp.java:96) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:97) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:917) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:696) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:623) at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:384) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:344) 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:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:595) Cookies: JSESSIONID=[986338DFB190EA2D17D576D9A87C999C]
|