-->
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: Chained Interceptor
PostPosted: Tue Sep 26, 2006 7:55 am 
Newbie

Joined: Tue Sep 26, 2006 7:31 am
Posts: 8
Location: Oslo
Relates to version 3.1.3:
I'm wondering how I should handle chaining of interceptors now that the Interceptor interface has gone through some updates. I'm trying a strategy similar to this: http://www.hibernate.org/92.html and have done so successfully earlier.

My problem relates to the new methods such as:
public String onPreparedStatement(String s)
public Object getEntity(..)
etc... where I am uncertain what to return in my ChainedInterceptor. Leaving them empty and returning null is obviously wrong, likewise does simply extending EmptyInterceptor seem to generate wrong behaviour as nothing seems to be delegated to my chained interceptors (even though I have overrided all the methods that my chained interceptors should take care of).

I was thinking about looking at the Event system as a replacement, but Interceptor allows me more code-resue without hassle.

I'm afraid I've got no stack trace to show you at this time, suffice to say that i simply need some advice on a chaining strategy in hibernate 3.1.3?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 26, 2006 8:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
extend EmptyInterceptor and it will work out of the box.

onPreparedStatement should return the incoming parameter if you don't want anything to change.

I don't see the problem with getEntity() ? null is an ok value.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 27, 2006 7:48 am 
Newbie

Joined: Tue Sep 26, 2006 7:31 am
Posts: 8
Location: Oslo
Okay, thank you. I've finally gotten it to work.
I was just sceptical to having EmptyInterceptor handling my ChainedInterceptor, because I want to be in full control over what get's passed to the chained ones. But it seems unproblematic.


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.