-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: javax.faces.el.EvaluationException: Problem one-to-many
PostPosted: Sun Dec 19, 2010 1:13 pm 
Newbie

Joined: Tue Nov 16, 2010 12:02 pm
Posts: 5
Hello everybody..

I've this problem when ii'm going to search in my DB via hibernate my objects..

The exception is :

Code:
javax.faces.FacesException: javax.faces.el.EvaluationException: Cannot get value for expression '#{BeanListasMedicos.medicos}'
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:431)
   at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:255)
   at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
   at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:146)
   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:147)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   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:128)
   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:293)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
   at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.jasper.JasperException: javax.faces.el.EvaluationException: Cannot get value for expression '#{BeanListasMedicos.medicos}'
   at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
   at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
   at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
   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 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
   at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
   at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
   at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
   at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:425)
   ... 16 more
Caused by: javax.faces.el.EvaluationException: Cannot get value for expression '#{BeanListasMedicos.medicos}'
   at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:405)
   at javax.faces.component.UIData.getValue(UIData.java:1054)
   at javax.faces.component.UIData.createDataModel(UIData.java:801)
   at javax.faces.component.UIData.getDataModel(UIData.java:781)
   at javax.faces.component.UIData.getRowCount(UIData.java:199)
   at org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:218)
   at org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:140)
   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:761)
   at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:663)
   at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:544)
   at org.apache.jsp.solecitarCambioMedico_jsp._jspx_meth_h_005fdataTable_005f0(solecitarCambioMedico_jsp.java:229)
   at org.apache.jsp.solecitarCambioMedico_jsp._jspx_meth_h_005fform_005f0(solecitarCambioMedico_jsp.java:168)
   at org.apache.jsp.solecitarCambioMedico_jsp._jspx_meth_f_005fview_005f0(solecitarCambioMedico_jsp.java:132)
   at org.apache.jsp.solecitarCambioMedico_jsp._jspService(solecitarCambioMedico_jsp.java:96)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
   ... 26 more
Caused by: javax.faces.el.EvaluationException: Exception getting value of property medicos of base of type : beans.BeanListasMedicos
   at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:99)
   at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:539)
   at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
   at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
   ... 42 more
Caused by: javax.faces.el.EvaluationException: Bean: beans.BeanListasMedicos, property: medicos
   at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:463)
   at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
   ... 45 more
Caused by: java.lang.reflect.InvocationTargetException
   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.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:459)
   ... 46 more
Caused by: org.hibernate.HibernateException: Javassist Enhancement failed: model.CentroMedico
   at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:142)
   at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:72)
   at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:402)
   at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3483)
   at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:298)
   at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:219)
   at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
   at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905)
   at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:873)
   at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590)
   at org.hibernate.type.EntityType.resolve(EntityType.java:412)
   at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139)
   at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
   at org.hibernate.loader.Loader.doQuery(Loader.java:752)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
   at org.hibernate.loader.Loader.doList(Loader.java:2228)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
   at org.hibernate.loader.Loader.list(Loader.java:2120)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
   at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
   at beans.BeanListasMedicos.getMedicos(BeanListasMedicos.java:31)
   ... 51 more
Caused by: java.lang.InstantiationException: model.CentroMedico_$$_javassist_10
   at java.lang.Class.newInstance0(Class.java:340)
   at java.lang.Class.newInstance(Class.java:308)
   at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:139)
   ... 74 more



The exception told me that the association between my two tables (MEDICO and CENTRO MEDICO) doesn't work and i don't know why because without this association everything is good and when i'm going to create my tables i've no errors -.-

This are the hibernates file of MEDICO and CENTRO MEDICO
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
   <class name="model.CentroMedico" table="CENTROMEDICO">
      <id name="id" column="id" type="java.lang.Integer">
         <generator class="increment"/>
      </id>
      <property name="nombre" column="nombre" type="java.lang.String"/>
      <property name="direccion" column="direccion" type="java.lang.String"/>
      <set name="medicos">
         <key column="centroMedico_id" />
         <one-to-many class="model.Medico" />
      </set>
   </class>
</hibernate-mapping>




MEDICO !
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
   <class name="model.Medico" table="MEDICO">
      <!-- El identificador y el nombre son los atributos que
      hereda de Empleado -->
      <id name="id" type="java.lang.Integer">
         <generator class="increment" />
      </id>
      <property name="nombre" column="nombre" type="java.lang.String"/>
      <property name="appelidos" column="appelidos" type="java.lang.String"/>
      <property name="usuario" column="usuario" type="java.lang.String"/>
      <property name="clave" column="clave" type="java.lang.String"/>
      <property name="numColegiado" column="numColegiado" type="java.lang.Integer"/>
      <many-to-one name="centroMedico" column="centroMedico_id"/>
      <one-to-one name="paciente" class="model.Paciente"/>
   </class>
</hibernate-mapping>c



Any suggestions ? The one-to-one relation works ...

This is the JSF File, but i think that's good because works perfectly without that one-to-many mapping !!
Code:
<html>
<head>
<title>SolecitarCambioMedico</title>
</head>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<body bgcolor="#FFFF9D">
<font color="#000080" FACE="Arial,Helvetica,Times">
<center>
<h3>Solecitar Cambio Medico</h3>
</center>
<hr>
<f:view>
   <h:form id="medicosList">
      <center>
      <h4>Medicos disponibles</h4>
      <h:dataTable id="medicos" value="#{BeanListasMedicos.medicos}" var="medicos"
         border="1">
         <h:column>
            <f:facet name="header">
               <h:outputText value="Nombre medico" />
            </f:facet>
            <h:outputText value="#{medicos.nombre}" />
         </h:column>
         <h:column>
            <f:facet name="header">
               <h:outputText value="Num colegiado" />
            </f:facet>
            <h:outputText value="#{medicos.numColegiado}" />
         </h:column>
         <h:column>
            <f:facet name="header">
               <h:outputText value="Seleccionar" />
            </f:facet>
            <h:commandLink id="select" action="selectMedico"
               actionListener="#{BeanMedico.selectMedico}">
               <h:outputText value="Quieres usted ?" />
               <f:param id="selectMedicoId" name="selectMedicoId" value="#{medicos.id}" />
            </h:commandLink>
         </h:column>
      </h:dataTable> <br>
      <br>
      </center>
   </h:form>
</f:view> </font>
</body>
</html>



Thanks you !!

GIANNI


Top
 Profile  
 
 Post subject: Re: javax.faces.el.EvaluationException: Problem one-to-many
PostPosted: Tue Dec 21, 2010 11:27 am 
Newbie

Joined: Tue Nov 16, 2010 12:02 pm
Posts: 5
any idea ?

UP


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.