-->
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.  [ 1 post ] 
Author Message
 Post subject: Throwing runtime exception when max results exceed
PostPosted: Tue Jan 20, 2009 3:40 pm 
Newbie

Joined: Tue Jan 20, 2009 11:48 am
Posts: 1
We use Hibernate 3.2.5 and Spring 2.0 in our project.

I want to limit the maximum number of records that a query can return so I am using a default max results property of hibernate template in conjunction with setting the property on query objects. In specific scenarios this property will be overridden to retrieve/allow more results. I have the following questions:

1 - Is there a generic way of setting a default max results value for all instances of SQLQuery/Query? Can I achieve it using some kind of interceptor or some other way of global initization of properties of queries? I still want to provide developers the ability to override this default value
2 - Is there a generic way of throwing a runtime exception (special behavior) whenever the max results exceed? I am looking for some kind of interceptor or event listener which can know the number of records returned by the HQL/SQL and then throw a runtime exception

I appreciate your help.

Thanks
Rahul


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.