-->
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.  [ 1 post ] 
Author Message
 Post subject: Hiberate NullPointerException when using JPA+EntityMode.DOM4
PostPosted: Tue Jun 09, 2009 5:46 am 
Newbie

Joined: Thu Aug 07, 2008 12:03 pm
Posts: 16
Hi, I'm running into an internal Hibernate null pointer exception if I try to use the following code:

Code:
//Spring JPA entityManager allow us to retriver the underlying session.
org.hibernate.Session session = (org.hibernate.Session)entityManager.getDelegate();
org.hibernate.Session dom4jSession = session.getSession(org.hibernate.EntityMode.DOM4J);

org.hibernate.Criteria c = dom4jSession.createCriteria(User.class);
c.list();


I get the following exception:

Code:
java.lang.NullPointerException
    at org.hibernate.type.EntityType.getIdentifierType(EntityType.java:520)
    at org.hibernate.type.EntityType.setToXMLNode(EntityType.java:377)
    at org.hibernate.property.Dom4jAccessor$ElementSetter.set(Dom4jAccessor.java:333)
    at org.hibernate.tuple.component.AbstractComponentTuplizer.setPropertyValues(AbstractComponentTuplizer.java:104)
    at org.hibernate.type.ComponentType.setPropertyValues(ComponentType.java:381)
    at org.hibernate.type.ComponentType.resolve(ComponentType.java:609)
    at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:298)
    at org.hibernate.persister.collection.AbstractCollectionPersister.readElement(AbstractCollectionPersister.java:725)
    at org.hibernate.collection.PersistentElementHolder.readFrom(PersistentElementHolder.java:125)
    at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1031)
    at org.hibernate.loader.Loader.readCollectionElements(Loader.java:669)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:614)
    at org.hibernate.loader.Loader.doQuery(Loader.java:724)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
    at org.hibernate.loader.Loader.loadCollection(Loader.java:2015)
    at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
    at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
    at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
    at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1743)
    at org.hibernate.type.CollectionType.getCollection(CollectionType.java:646)
    at org.hibernate.type.CollectionType.resolveKey(CollectionType.java:430)
    at org.hibernate.type.CollectionType.resolve(CollectionType.java:424)
    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)


The line 520 of org.hibernate.type.EntityType contains the following:

Code:
return factory.getIdentifierType( getAssociatedEntityName() );


It seems the factory object is null.... Why???


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

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.