1 Reply Latest reply on Jun 20, 2006 5:46 AM by pssvarma

    disable EJB3 lazy loading

    damadei

      Hi All!

      I'm trying to send an EJB Persistent Entity to my JSP but when trying to display it's properties they are enhanced by cglib and considered lazy as per Hibernate 3 defaults.

      I was able to disable the lazy loading by creating the hibernate hbm file and setting the class as lazy="false" but I'd like to use just EJB3 elements. Is this possible?

      I'm using JBoss 4.0.4CR2.

      Thanks in advance.

      Daniel

        • 1. Re: disable EJB3 lazy loading
          pssvarma

          Hi all
          i m working with ejb3 with JSF.Here I have got the on eentity object by em.find method.When im trying to set this object to the Other entity.Here im using Stateless session Bean.Can any one give solution for my problem ..plzzz.

          Here is theError
          org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.ise.his.entity.Person.contacts, no session or session was closed
          at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
          at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
          at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:97)
          at org.hibernate.collection.PersistentBag.isEmpty(PersistentBag.java:229)
          at com.ise.his.ejb.client.data.PersonData.(PersonData.java:42)
          at com.ise.his.web.pages.user.Adduser.submit(Adduser.java:152)
          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:585)
          at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
          at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
          at javax.faces.component.UICommand.broadcast(UICommand.java:106)
          at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
          at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
          at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
          at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
          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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
          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:869)
          at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
          at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
          at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
          at java.lang.Thread.run(Thread.java:595)


          Thanks in advance..