-->
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: loading a collection object from result set is taking time
PostPosted: Mon Aug 17, 2009 2:37 am 
Newbie

Joined: Mon Aug 17, 2009 2:25 am
Posts: 1
Hi

i am trying to run a hibernate query
<query name="com.qwest.rx.entity.OutageT.all.active.current.bsi.version">
select outage from OutageT as outage
left join fetch outage.tickets
left join fetch outage.affectedTns
left join fetch outage.products
where outage.isCurrent = true
and outage.isActive = true
and outage.status != 'New'
and outage.outageType = 'BSI'
</query>
which fetches around 15000 records. the sql generated from this query runs fine..within few seconds. All these records will be stored in a collection as a arraylist. But the problem is, hibernate is taking lot of time to load the collection of objects. It takes around 8 minutes. basically resultset to Object mapping is taking time. Below is the code snippet to fetch the result. I dont know if there is any configuration changes. I tried with the lazy loading as well.



public static Collection executeQuery(String queryName) {

Transaction tx = null;

Session session = null;

Collection results = null;

try {


_sessions = SessionFactoryUtil.getSessionFactory();

session = _sessions.openSession();

Query query = session.getNamedQuery(queryName);

//query.setCacheable(true);

tx = session.beginTransaction();

results = query.list();

System.out.println(results.size());


tx.commit();


} catch (MappingException e) {

log.error("EXCEPTION : 7105 - Exception while DB call...", e);

} catch (HibernateException e) {

log.error("EXCEPTION : 7106 - Exception while DB call...", e);


if (tx != null)

try {

tx.rollback();

} catch (HibernateException e1) {

log.error("EXCEPTION : 7107 - Exception while DB call...", e1);

}


} finally {

try {

if(session != null)session.close();

} catch (HibernateException e1) {

log.error("EXCEPTION : 7109 - Exception while DB call...", e1);

}

}

return results;


}


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.