-->
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: Performance of find statement
PostPosted: Thu Sep 11, 2003 10:07 am 
Newbie

Joined: Mon Sep 08, 2003 12:32 pm
Posts: 10
Hi,

I just ported my app from Ibatis to Hibernate because
some high placed guys just chose Hibernate as our official ORM system.
It was relatively easy to learn. The port was finished in 3 days.

Now the big surprise: Performance went from 9 secs to 145 secs!!!!

Profiling shows that most of the time is spend in thefind statement below:


List list = session.find("from com.accovia.domain.Supplements as supp where "
+ "supp.codeSupplId = ? and supp.periodeId = ?",
new Object[] { new Long(codeSuppl), new Integer(periodeId) },
new Type[] { Hibernate.LONG, Hibernate.INTEGER });


I would like to ask these questions:

1. How I can make the above find faster ?
2. Can I know if it is translated to a prepared statement or not?
3. Should I transform the find into a load statement ? (by adding an index)

thanks
/thanh nguyen/

NB: All of this is true.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2003 10:30 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
How I can make the above find faster ?


By reading the Hibernate documentation and understanding how to use proxies and/or outer join fetching.

It helps to enable SQL logging, so you can see what Hibernate is actually *doing*, so that you can then optimize this.

You probably have an n+1 selects problem.


Quote:
Can I know if it is translated to a prepared statement or not?


It is using a prepared statement, as always.


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.