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: Intercepting prepared statements with Hibernate 2
PostPosted: Tue Aug 08, 2006 8:42 am 
Newbie

Joined: Wed Jul 26, 2006 10:35 am
Posts: 11
I wrote an interceptor to intercept some queries for an application running Hibernate 2. Unfortunately, the application uses prepared statements in certain classes. However, Hibernate 2's interceptor doesn't provide the onPrepareStatement that Hibernate 3's interceptor does.

Is there a way for me to be able to intercept these prepared statements as well? Rewriting the application to not make use of prepared statements or altering the code in any other way is not possible, as well as migrating to Hibernate 3...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 4:08 am 
Newbie

Joined: Wed Jul 26, 2006 10:35 am
Posts: 11
Just as I was going home from work yesterday a solution came to my mind. Although I doubt any of you stumbled onto the same problem I'd still like to share the solution.

Since there is a single point of execution of prepared statements in the application, code alteration on that point is reduced to a minimum. So I let my interceptor implement an interface containing an onPrepareStatement method and just before I execute my prepared statement I call this method of the interceptor.

Probably doesn't work for everybody, but certainly does for me :)


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.