-->
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: Excessive Hibernate Queries for Child 'Bag' Object
PostPosted: Fri Apr 02, 2010 2:06 pm 
Newbie

Joined: Thu Apr 01, 2010 5:52 pm
Posts: 1
Our DB monitoring tools registered massive spikes in Hibernate queries outside normal application hours. (e.g., 180k-240k queries per hour) Strangely, the queries regard a child container; queries for the parent don't show up on radar. Any insight to help troubleshoot, explain, or resolve this behavior would be greatly appreciated.

(Column/Package names changed to protect the innocent.)

The rogue query:
Code:
        select objec0_.USER_ID as USER2_1_,
         objec0_.OBJECT_ID as OBJ1_1_, objec0_.OBJECT_ID as
         OBJ1_3_0_, objec0_.USER_ID as USER2_3_0_,
         objec0_.EVENT as EVENT3_3_0_, objec0_.PARENT as
         PARENT4_3_0_, objec0_.OID as OID5_3_0_,
         objec0_.LAST_UPDATED_BY as LAST6_3_0_,
         objec0_.LAST_UPDATED_TIMESTAMP as LAST7_3_0_ from
         OBJECT_TABLE objec0_ where
         objec0_.USER_ID=:1 order by
         objec0_.LAST_UPDATED_TIMESTAMP desc


The Hibernate mapping file for ObjectImpl:
Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-lazy="false">
  <class name="my.package.ObjectImpl" table="OBJECT_TABLE">
    <id name="id" type="string" column="OBJECT_ID">
      <generator class="uuid"/>
    </id>
    <many-to-one name="user" class = "my.package.UserImpl" column="USER_ID"/>
    <property name="eventType" column="EVENT">
        <type name="my.package.StringEnumUserType">
          <param name="enumClassName">my.package.ObjectImpl$Event</param>
        </type>
    </property>   
    <property name="parent" type="string" column="PARENT" length="128"/>
    <property name="oID" type="string" column="OID" length="128"/>       
    <property name="createdBy" column="LAST_UPDATED_BY" type="string" length="100"/>
    <property name="createdTimestamp" column="LAST_UPDATED_TIMESTAMP" type="timestamp"/>
  </class>

  </hibernate-mapping>


.. and the excerpt from UserImpl that maps ObjectImpl:
Code:
    <bag name="objects" cascade="all,delete-orphan" inverse="true"
      order-by="LAST_UPDATED_TIMESTAMP desc">
      <key column="USER_ID" not-null="true" />
      <one-to-many class="my.package.ObjectImpl" />
    </bag>


ObjectImpl is not handled by any (a)synchronous jobs and is rarely referenced w/in the application. Why is Hibernate so enamored w/ this object? Why is ObjectImpl queried so aggressively and not UserImpl?

Ideas to help troubleshoot/resolve this issue are greatly appreciated.


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.