-->
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: Overriding Hibernate Events for flush performance
PostPosted: Tue Mar 22, 2005 7:17 am 
Newbie

Joined: Tue Mar 22, 2005 6:45 am
Posts: 15
Hibernate version: 3 rc1

Hi, sorry for the length of this post, this problem needs a little explaining.

I understand that the EventListener framework is in place to allow developers to implement their own structure for parts of the Hibernate persistence mechanism.

In our situation we have a very large and complicated domain model in memory with upto 25,000+ objects. We are using Hibernate in a transaction bound manner with auto-flush on as we need to run complex queries that we would like the db to bare the brunt of (and we don't want any stale data or to miss any data that has changed in the cache). We are experiencing performance problems with the auto flush that runs prior to each finder call as it is processing every entity in the cache to determine if its dirty and we call a lot of finders in this particular transaction.

Our initial solution was that we actually have all the required information at hand to tell Hibernate's flush mechanism exactly which entities and their properties are dirty when the flush occurs as we can easily record this information as the transaction progresses due to our wrapping of the hibernate persisted objects.

However there are a couple of problems we have come across:

1) The default implementions of the EventListeners (DefaultFlushEntityEventListener etc.) have lots of private methods and references to protected classes which means that we can't easily extend these listeners to alter the behaviour, I was under the impression that these classes were there to be extended? Is this area going to be changed in future revisions of Hibernate to facilitate extending these EventListeners?

2) I eventually copied down all the private methods required down into our implementation of the AutoFlushEventListener and implemented our own version of the flushEntities method from AbstractFlushingEventListener. This simply skipped over any entities that we knew hadn't changed and didn't need syncing (i.e. didn't generate a FlushEntityEvent for them). However, shortly after a flush, collections started failing with NullPointerException in DefaultInitializeCollectionEventListener.initializeCollectionFromCache where the persister for the collection did not exist. Looking at the onFlushEntity method in the DefaultFlushEntityEventListener seemed to show other work happening regarding collections that seemed to need to be run on all entities regardless of whether they were dirty or not, is this the case, if so what is it doing? Is it possible to seperate out these chunks of work?

regards,
Mike

_________________
Michael Hurd
Software Engineer
Nexagent LTD


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 23, 2005 3:58 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Certainly the events are new functionality and yes they are meant to be an extension point.

That being said, all the use-cases people would like to use custom listeners is be no means a complete picture.

If you have something specific you'd like to see, then by all means enter a feature request into JIRA. And I don't mean "make all default listener methods public" ;)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 29, 2005 5:12 am 
Newbie

Joined: Tue Mar 22, 2005 6:45 am
Posts: 15
Okay, I have entered a request, marked it as an improvement, reference is HHH-287. Have you any information regarding my second question on what is happening r.e. collections in the onFlushEntityMethod in the DefaultFlushEntityEventListener?

_________________
Michael Hurd
Software Engineer
Nexagent LTD


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.