-->
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.  [ 4 posts ] 
Author Message
 Post subject: Finder Performance Issues
PostPosted: Thu Jul 31, 2008 3:42 pm 
Newbie

Joined: Thu Jul 31, 2008 3:33 pm
Posts: 4
Hibernate version: 2.1

Code between sessionFactory.openSession() and session.close():
Code:
           List records = session.find(
                "from BalanceVO as balance"
                + " where balance.period.start <= ? and balance.period.end > ?"
                + " and balance.userId = ?",               
                new Object[] { date, date, userId },
                new Type[] { Hibernate.DATE, Hibernate.DATE, Hibernate.STRING }
            );                                   
           
            //HibernateUtil.closeSession();
           
            return (BalanceVO) records.iterator().next();


Name and version of the database you are using:
MySQL 5.0

Question:
Hi guys!

I really need your help on this one.

I'm having problems with the performance for certain finders. In this case, the table for BalanceVO contains 2375 records and it grows by at least half every month. Can anybody please tell me how I can optimize this kind of scenario?

Thanks and best regards.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 5:41 pm 
Newbie

Joined: Thu Jul 31, 2008 3:33 pm
Posts: 4
Please let me know if there is any more information I could provide on this subject. It is very important that I have this up and running as soon as possible and I have no idea where to begin and I have not been able to find any useful information as of yet.

Thanks so much!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 01, 2008 1:36 pm 
Newbie

Joined: Thu Jul 31, 2008 3:33 pm
Posts: 4
I have tried using lazy loading on a many-to-many relationship on the BalanceVO entity, which I though would at least improve processing time, to no avail. The query still takes the same amount of time to complete.

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 01, 2008 1:39 pm 
Newbie

Joined: Thu Jul 31, 2008 3:33 pm
Posts: 4
Just in case it helps, here is the BalanceVO mapping file without lazy loading:

Code:
<?xml version="1.0" encoding="UTF-8"?>

<!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.acmgrp.tellarian.users.balance.BalanceVO"
        table="TBALANCE"
        dynamic-update="false"
        dynamic-insert="false"
        select-before-update="false"
        optimistic-lock="version"
    >

        <id
            name="id"
            column="PK"
            type="java.lang.String"
        >
            <generator class="assigned">
              <!-- 
                  To add non XDoclet generator parameters, create a file named
                  hibernate-generator-params-BalanceVO.xml
                  containing the additional parameters and place it in your merge dir.
              -->
            </generator>
        </id>

        <property
            name="initial"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            access="property"
            column="initial_balance"
        />

        <property
            name="totalAssigned"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            access="property"
            column="totalAssigned"
        />

        <property
            name="available"
            type="java.math.BigDecimal"
            update="true"
            insert="true"
            access="property"
            column="available"
        />

        <property
            name="userId"
            type="java.lang.String"
            update="true"
            insert="true"
            access="property"
            column="fk_user"
        />

        <many-to-one
            name="user"
            class="com.acmgrp.tellarian.users.UserVO"
            cascade="none"
            outer-join="auto"
            update="false"
            insert="false"
            access="property"
            column="fk_user"
        />

        <many-to-one
            name="period"
            class="com.acmgrp.tellarian.users.periods.PeriodVO"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            access="property"
            column="fk_period"
        />

        <set
            name="services"
            table="TBL_BALANCE_SERVICE"
            lazy="false"
            inverse="true"
            cascade="none"
            sort="unsorted"
        >

              <key
                  column="fk_balance"
              >
              </key>

              <many-to-many
                  class="com.acmgrp.tellarian.users.services.ServiceVO"
                  column="fk_service"
                  outer-join="auto"
               />

        </set>

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-BalanceVO.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.