-->
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: NPE: AbstractTuplizer - create proxy with null proxyFactory
PostPosted: Wed May 11, 2005 9:06 pm 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
I'm getting the NPE shown below when performing a session.get(Port.class, portID). It seems that despite the fact that the NE persister
declares the entity as being lazy and therefore AbstractTuplizer not
creating a proxyFactory for it, when loading an instance of Port which
has a reference to an NE, the getProxyFactory() method is called in
order to create a proxy, and failing

Hibernate version: 3.03

Fragment of Mapping documents:

Code:
<class name="Port" table="PORT" discriminator-value="PO">

        <!--- properties --->
        <many-to-one name="project" class="Project"lazy="true" column="PROJECT_ID"/>
        <many-to-one name="ne" class="NE" column="NE_ID" index="I_PORT_NE" />

    </class>


<class name="NE" table="NE" abstract="true">
... other properties ...
        <set name="ports"
             inverse="true"
             cascade="save-update">
            <key column="NE_ID"/>
            <one-to-many class="Port"/>
        </set>

</class>


Code between sessionFactory.openSession() and session.close():
getSessionFactory().openSession();

getSession().beginTransaction();
getSession().saveOrUpdate(ne);
getSession().saveOrUpdate(nePort);
getSession().flush();

neID = getSession().getIdentifier(ne);
nePortID = getSession().getIdentifier(nePort);

getSession().commitTransaction();
getSession().clear();
getSession().disconnect();


getSessionFactory().openSession();
getSession().beginTransaction();

port = getSession().get( Port.class, nePortID));
// exception thrown here ^
[/code]

Full stack trace of any exception that occurs:
java.lang.NullPointerException
at org.hibernate.tuple.AbstractTuplizer.createProxy(AbstractTuplizer.java:249)
at org.hibernate.persister.entity.BasicEntityPersister.createProxy(BasicEntityPersister.java:2813)
at org.hibernate.event.def.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:218)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:163)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:79)
at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:655)
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:261)
at org.hibernate.type.EntityType.resolve(EntityType.java:286)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:105)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:510)
at org.hibernate.loader.Loader.doQuery(Loader.java:420)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:211)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1312)
at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:116)
at org.hibernate.loader.entity.EntityLoader.load(EntityLoader.java:101)
at org.hibernate.persister.entity.BasicEntityPersister.load(BasicEntityPersister.java:2461)
at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:350)
at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:331)
at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:113)
at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:167)
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:79)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:621)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:614)
at au.com.siemens.ecs.spct.command.CreateTrailCommandTest.step1_execCommand(CreateTrailCommandTest.java:109)
at au.com.siemens.ecs.spct.command.CreateTrailCommandTest.testCreateTrailUsingCommand(CreateTrailCommandTest.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)

_________________
Cheers,

Bonny

please don't forget to rate :)


Top
 Profile  
 
 Post subject: Help...
PostPosted: Thu May 12, 2005 2:48 am 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
Anyone on the Hibernate team can shed some light on this?

_________________
Cheers,

Bonny

please don't forget to rate :)


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.