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.  [ 3 posts ] 
Author Message
 Post subject: NPE within Hibernate delete listener?
PostPosted: Mon May 18, 2009 5:52 pm 
Beginner
Beginner

Joined: Tue Mar 17, 2009 12:19 pm
Posts: 22
I know we're not supposed to be quick to assume there are bugs in Hibernate, and I'm no exception as this is my first time using the actual Hibernate Session (have been using JPA Entity Manager until now). I'm doing some testing with batching and I'm getting a NullPointerException within the Hibernate 3.3.1 code. I create 30 persistent objects and iterate calling session.save() for each one. I can see within the debugger that Cascade.java (line 378) invokes the following method with an explicit "null" value for the Set parameter.

Code:
eventSource.delete( entityName, orphan, false, null );


Then the stack gets to DefaultDeleteEventListener (line 205) and attempts to invoke a method on the set that was passed in null.

Code:
if ( transientEntities.contains( entity ) ) {


This is where the NPE occurs. Why is there no exception handling here?

Also, I would prefer to just stick with JPA here, but I was unable to find a JPA equivalent to session.setCacheMode(CacheMode.IGNORE), is there something like this? Does JPA simply not support batching like Hibernate?

Thanks!


Top
 Profile  
 
 Post subject: Re: NPE within Hibernate delete listener?
PostPosted: Tue May 19, 2009 5:11 pm 
Beginner
Beginner

Joined: Tue Mar 17, 2009 12:19 pm
Posts: 22
I'm thinking this may be caused by the fact that I'm not creating a Hibernate SessionFactory but a JPA EntityManagerFactory and then calling:

Code:
SessionImpl session = (SessionImpl) _em.getDelegate();


This call properly returns a Hibernate Session. Could it still be problematic?


Top
 Profile  
 
 Post subject: Re: NPE within Hibernate delete listener?
PostPosted: Tue May 19, 2009 6:46 pm 
Beginner
Beginner

Joined: Tue Mar 17, 2009 12:19 pm
Posts: 22
Nevermind. Tried with a pure Hibernate Session and see the same results.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.