-->
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: Preformance
PostPosted: Wed Nov 02, 2005 8:40 pm 
Why hibernate is so slow, it take 28sec to get the same data, where i can get it from the raw sql withn 4sec;

This is my H mapping:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="com.w.core.wUser" table="W_USER" lazy="true">
<id name="id" type="long">
<generator class="native"/>
</id>
<property name="userName" type="string" not-null="true" unique="true"/>
<property name="password" type="binary" not-null="true"/>
<property name="name" type="string"/>
<property name="verificationQuestion" type="string"/>
<property name="verificationAnswer" type="string"/>
<many-to-one name="region" class="com.w.core.Region" lazy="true"/>
<many-to-one
name="sellerDetails"
class="com.w.core.wSellerDetails"
cascade="all"/>
<set name="offers" inverse="true"> <!--sort="com.w.core.wOfferDateComparator">-->
<key column="seller"/>
<one-to-many class="com.w.core.wOffer" lazy="true"/>
</set>
<set name="tenderOffers" inverse="true">
<key column="offerer"/>
<one-to-many class="com.w.core.TenderOffer" lazy="true"/>
</set>
<property name="isReseller" type="boolean">
<column name="isreseller"/>
</property>
<property name="resellerId" type="long">
<column name="reseller_id"/>
</property>
<property name="buyerApproved" type="boolean">
<column name="buyer_approved"/>
</property>
<property name="sms" type="boolean"/>
<property name="referrals" type="integer"/>
<property name="referal" type="string"/>
<property name="banned" type="boolean"/>
<property name="weeklyReport" type="calendar"/>
<property name="datePlaced" type="calendar">
<column name="dateplaced"/>
</property>
<many-to-one name="userType" class="com.w.core.wUserType" lazy="true">
<column name="usertype"/>
</many-to-one>
<property name="companyName" type="string">
<column name="company_name"/>
</property>
</class>
</hibernate-mapping>


Only has 751 raw of data in the table,
and this is the class i use;

result = sess.find("from com.w.core.wUser u "
+ " where u.resellerId = ? "
+ var
+ " order by u.name",
getId(), Hibernate.LONG);
logger.debug("sess.find took " + " : " + (System.currentTimeMillis() - start)/1000 + " seconds ");

and it take 24sec, i try it without order by, and only less by one second,

please give me some feed back to fix this issue;
im using version 2.0.3 of hibernate. on postsql sever :)


Top
  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 9:19 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Put
Code:
<property name="show_sql">true</property>


in your hibernate.cfg.xml and/or use http://www.p6spy.com to get more information about what hibernate is doing.

If you see ans joins this means you should make sure this associations are loaded lazyly.

HTH
Ernst


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.