-->
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: Query Timeout not working
PostPosted: Mon May 17, 2010 10:30 am 
Newbie

Joined: Mon May 17, 2010 10:24 am
Posts: 5
Hi,
I currently cannot get the hibernate query timeout to work. Also once it is working (hopefully) I'm not sure which exception to catch to differentiate between a real database exception vs the timeout. We have a requirement to time out and instruct user to refine their search. Since this is a configurable timeout and different for different pages we cannot use the container's datasource settings as those would effect entire app. Env and code is below, any help is greatly appreciated.

Hibernate 3.x
Websphere 7.x
Java 6
Oracle 10g

List<Object[]> resultSet = null;
Session session = null;
try {
session = getSession();
Query sqlQuery = session.createSQLQuery(argQuery);
pm.bindParameters(sqlQuery);
sqlQuery.setTimeout(argCriteria.getQueryTimeoutSeconds());
resultSet = sqlQuery.list();
}catch(DataAccessResourceFailureException dae){
String errMsg = "Problem running query: " + argQuery
+ "\nerror=" + dae.getMessage();
LOGGER.error(errMsg, dae);
throw new OBSServiceException(errMsg, dae);
}catch(IllegalStateException ie){
String errMsg = "Problem running query: " + argQuery
+ "\nerror=" + ie.getMessage();
LOGGER.error(errMsg, ie);
throw new OBSServiceException(errMsg, ie);
}catch(HibernateException he){
//TODO how do we tell if its a timeout exception
//if(queryTimeOut)
// throw OBSQueryTimeoutException()
String errMsg = "Problem running query: " + argQuery
+ "\nerror=" + he.getMessage();
LOGGER.error(errMsg, he);
throw new OBSServiceException(errMsg, he);
}finally{
if(session != null)
releaseSession(session);
}


Top
 Profile  
 
 Post subject: Re: Query Timeout not working
PostPosted: Wed May 21, 2014 6:49 am 
Newbie

Joined: Wed May 21, 2014 6:46 am
Posts: 1
Dears, same problem for me also, can u pelase provide some solution

Thx for the help


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.