Hello,
I'm occasionally getting the following NPE exception when I try to load an object. Also, strangely, if I do the same load directly after one that caused an exception the second load will always be successful.
Any clues about what could be causing this?
I'm using Spring to manage transactions/session.
Code:
java.lang.NullPointerException
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:331)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3007)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:137)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:830)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:850)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:57)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:49)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:420)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2044)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1918)
at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1847)
at ourcommunity.util.hibernate.HibernateHelper$1.doInHibernate(HibernateHelper.java:49)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:147)
at ourcommunity.util.hibernate.HibernateHelper.get(HibernateHelper.java:44)
at ourcommunity.newsletter.dao.NewsletterDAO.findEditionVariation(NewsletterDAO.java:67)
.
.
.
Mapping is this
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="ourcommunity.newsletter.dao.EditionVariationDO" table="NewsletterEditionVariation"
select-before-update="true"
dynamic-update="true">
<cache usage="read-write" />
<id name="id" type="int" column="ID" unsaved-value="0" >
<generator class="identity"/>
</id>
<version name="version" />
<property name="status" column="Status" />
<property name="variation" column="Variation" />
<property name="deliveryOption" column="DeliveryOption" />
<property name="bulkEmailId" column="BulkEmailID" />
<property name="editionId" column="NewsletterEditionID" />
</class>
</hibernate-mapping>