-->
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: EntityJoinWalker bombs out with Hibernate 3.6
PostPosted: Thu Sep 08, 2011 9:09 am 
Newbie

Joined: Wed Jun 17, 2009 5:01 am
Posts: 5
Dear all,
I just migrated from Hibernate v 3.5.4 to version 3.6.7. I made NO changes to the code (except for replacing the AnnotationConfiguration class with Configuration as per the relevant migration guide) nor to the mapping of my classes. But now my application crashes at startup with a NPE in the EntityJoinWalkerClass:

Exception in thread "main" java.lang.NullPointerException
at org.hibernate.loader.entity.EntityJoinWalker$AssociationInitCallbackImpl.locateKeyManyToOneTargetIndex(EntityJoinWalker.java:241)
at org.hibernate.loader.entity.EntityJoinWalker$AssociationInitCallbackImpl.findKeyManyToOneTargetIndices(EntityJoinWalker.java:222)
at org.hibernate.loader.entity.EntityJoinWalker$AssociationInitCallbackImpl.resolve(EntityJoinWalker.java:194)
at org.hibernate.loader.entity.EntityJoinWalker.<init>(EntityJoinWalker.java:76)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:109)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:71)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:54)
at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:133)
at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1914)
at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1937)
at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:3205)
at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:3191)
at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:728)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:348)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
at HibernateUtil.getSessionFactory(HibernateUtil.java:111)
at HibernateUtil.getSession(HibernateUtil.java:133)
at DbCleaner.dropTables(DbCleaner.java:54)
at DbCleaner.cleanAndResetDB(DbCleaner.java:40)
at DbCleaner.main(DbCleaner.java:168)

Unfortunately this kind of behavior is very difficult to debug, because Hibernate itself is very skimpy on details. Smells like something wrong with the mapping, but I wonder why it used to work fine and now it crashes with the new Hibernate release.

Any ideas what the problem could be or where I should be looking?

Thanks in advance
Emmanuele


Top
 Profile  
 
 Post subject: Re: EntityJoinWalker bombs out with Hibernate 3.6
PostPosted: Fri Apr 12, 2013 10:11 am 
Newbie

Joined: Fri Apr 12, 2013 9:57 am
Posts: 1
I'm really new in the community (and in Hibernate also) so I may be infringing some rule while responding to a 2011 question or saying something incorrect.

I faced exactly the same problem. In my situation I had an elementcollection, eagerly loaded, in a class A with an Id association with another class B identified by a composite-id. The columns of B composite id were used in the joinColumns collection of A elementCollection attribute. When invoking buildSessionFactory, NPE was thrown.
After debugging the org.hibernate.loader.entity.EntityLoader.<init> code, I detected while reading a code comment, that the eagerly property was the problem (I still don't understand why) because the function of the NPE is only invoked if eager is used.

The code comment is "// for each association with a composite id containing key-many-to-one(s), find the bidirectional side of
// each key-many-to-one (if exists) to see if it is eager as well. If so, we need to track the indices", in file org.hibernate.loader.entity.EntityJoinWalker.

So to fix the problem, I removed the eager annotation of the elementCollection, and simulated it through accesing the attribute while the transaction is opened in the DAO.

EDIT: This happens to me in version 4.1.4-Final.


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.