Hi,
I am using hibernate3.0. I am facing proxy disabled problem.
In Entity.hbm.xml
I defined class lazy=false also
<set name="items" table="ITEM" fetch="join" lazy="false">
<key column="ID"/>
<one-to-many class="Item"/>
</set>
In item.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.webdunia.spring.domain">
<class abstract="true" name="Item" table="ITEM" lazy="false">
<cache usage="read-write"/>
<id name="id" column="ID" type="string" unsaved-value="null">
<generator class="identity"/>
</id>
<discriminator column="ASSO_TYPE" type="string"/>
<property name="title" column="TITLE" type="string" not-null="true"/>
<property name="about" column="ABOUT" type="string"/>
<property name="excerpt" column="EXCERPT" type="string"/>
<property name="role" column="ITEMROLE" type="string"/>
<property name="itemState" column="ITEMSTATE" type="string"/>
<many-to-one name="owner" class="SystemUser" column="USERID"/>
<property name="creationDate" column="CREATIONDATE" type="timestamp"/>
<property name="aggregationEnabled" column="AGGREGATIONENABLED" type="java.lang.Integer"/>
<property name="familyFilterEnabled" column="FAMILYFILTERENABLED" type="java.lang.Integer"/>
<many-to-one name="media" class="MediaItem" column="MEDIAID"/>
<subclass name="EntityItem" discriminator-value="dc_entity" lazy="false">
<join table="ENTITYITEM">
<key column="ITEMID"/>
<many-to-one name="entity" column="ENTITYID" not-null="true" class="Entity"/>
<property name="rating" column="RATING"/>
<property name="votes" column="VOTES"/>
<property name="views" column="VIEWS"/>
<property name="responseReadRole" column="RESPONSEREADROLE" type="string"/>
<property name="responseWriteRole" column="RESPONSEWRITEROLE" type="string"/>
</join>
</subclass>
</class>
</hibernate-mapping>
When i am trying to fetch value of items in entity object. It is giving me error.
2008-09-18 13:11:29,913 DEBUG [org.hibernate.impl.SessionImpl] closing session
2008-09-18 13:11:29,913 DEBUG [org.hibernate.jdbc.ConnectionManager] connection already null in cleanup : no action
2008-09-18 13:11:29,913 INFO [STDOUT] >>>>>>>. EntityDAOImpl loadEntity Exception : null
2008-09-18 13:11:29,913 INFO [STDOUT] java.lang.NullPointerException
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.tuple.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:372)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:3121)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:232)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:173)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:889)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:857)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:266)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.type.EntityType.resolve(EntityType.java:303)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:113)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.Loader.doQuery(Loader.java:717)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:71)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1693)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:827)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:229)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.Loader.doList(Loader.java:2150)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.Loader.list(Loader.java:2024)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:300)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1127)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:926)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:917)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:909)
2008-09-18 13:11:29,913 INFO [STDOUT] at com.webdunia.spring.dao.hibernate.EntityDAOImpl.loadEntity(EntityDAOImpl.java:31)
2008-09-18 13:11:29,913 INFO [STDOUT] at com.webdunia.spring.service.EntityService.getEntityByName(EntityService.java:53)
2008-09-18 13:11:29,913 INFO [STDOUT] at com.webdunia.spring.web.controller.HomeController.handleRequest(HomeController.java:23)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
2008-09-18 13:11:29,913 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
2008-09-18 13:11:29,913 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
2008-09-18 13:11:29,913 INFO [STDOUT] at com.webdunia.spring.web.filter.EntityLookupProxyFilter.doFilter(EntityLookupProxyFilter.java:91)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
2008-09-18 13:11:29,913 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
2008-09-18 13:11:29,913 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
I do not want to use proxy. plz help me. how it will be resolved it.
|