-->
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: Using eventListener to modify query
PostPosted: Thu Aug 14, 2008 3:17 am 
Newbie

Joined: Fri Jul 28, 2006 8:10 am
Posts: 5
Hibernate version: 3.2.6

I am using an hibernate event listener (SaveOrUpdateEventListener) to transparently setting properties of an object before saving it into the databse. This is working perfectly fine.

But I am having problems with implementing the second requirement:
I want to intercept the loading of objects from the database, change the query (read: adding a new contraint) and then letting the database load the objects with the modified query.

I checked the existing hibernate event listener, but I didn't find a way to manipulate the query.

Does anybody has a tip how to implement this? Is there a certain point where I can intercept and change the query?

Thanks for your help and if something is unclear with my description, please ask

stefon


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 14, 2008 7:30 am 
Newbie

Joined: Fri Jul 28, 2006 8:10 am
Posts: 5
I found out that I can use the EmptyInterceptor to implement an Interceptor which uses the
String onPrepareStatement(String sql)
method.

But this only allows me to manipulate the Query in the form of an SQL string.

Is there a point where I can manipulate the Query in the form of an Object Query tree?


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.