-->
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.  [ 5 posts ] 
Author Message
 Post subject: DefaultLoadEventListener for Criteria queries
PostPosted: Thu Feb 24, 2005 10:24 am 
Newbie

Joined: Tue Feb 15, 2005 10:09 am
Posts: 5
Hibernate version: 3.0 beta4

I've noticed that the EventListeners do not fire in case an object is getting loaded from Criteria query. If I load the same object from Session.load() or Session.get() the listeners do fire.

In our instance we are trying to intercept using custom DefaultLoadListener to meet our needs. Is this a design decision or something that sould be working ?

-Sanket


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 24, 2005 10:35 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
LoadEvent occurs when an object is *fetched*, not for a query.

You should look at PreLoadEvent / PostLoadEvent, which fire when objects are initialized from a ResultSet.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 24, 2005 11:12 am 
Newbie

Joined: Tue Feb 15, 2005 10:09 am
Posts: 5
But if I am not mistaken, if the object is not even found, non of these events will fire ( I haven't tried it yet will try shortly ).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 24, 2005 1:01 pm 
Newbie

Joined: Tue Feb 15, 2005 10:09 am
Posts: 5
Ok, tested with PreLoad and PostLoad event listeners, and none fire in case of criteria query. Basically I need a consistent mechanism to intercept when a object is not found within hibernate framework ( to fit in with the legacy data model, don't ask why.. ;) ).

The custom load event listener ( extending from DefaultLoadEventListener ), seems to work for HQL query as well as Session.load() and Session.get() API. The only one I'm having trouble with is the criteria query.

Looking through the source, it doesn't seem like any EventListeners are fired during the criteria query. Your help will be greatly appreciated.

Thanks,
-Sanket


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 24, 2005 9:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
There is no notion of "object not found" in a query. Sorry.


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