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: Some performance questions with Hibernate
PostPosted: Sun Jan 09, 2005 10:53 pm 
Newbie

Joined: Thu Jan 06, 2005 4:25 pm
Posts: 12
Location: Redwood City, CA
Hi,

I'm new to Hibernate. To familiarize myself, I made a small test application that uses two database tables with a one-to-many relationship. I read Hibernate in Action, and followed most of their examples verbatim. My relationship is mapped using an "idbag" tag with lazy set to "false".

The good news is, my test application works fine. It does exactly what I expected with regard to what ends up in the database.

However, I have a couple of concerns about performance after viewing the SQL that Hibernate generates:

(1) I did a delete using a query string -- session.delete("from x in class League where x.key='TEST'"). I expected this to issue one SQL statement to the database. Instead, it issues several statements, one for each row that matches the condition.

(2) I expected Hibernate to use some sort of join to satisfy the one-to-many mapping between two tables. Instead, what I see in the log is that every time I get an object Hibernate issues two SQL statements, one to get the object from the first table and one to get the dependent records from the 2nd table.

(3) If I update one property of a persistent object, Hibernate issues an UPDATE statement for all the properties, not just the one I changed. I was expecting it to be smart enough to only update the changed property.

These aren't necessarily huge issues but there are some in my organization who are skeptical of O/R mapping tools and will want me to be able to explain these behaviors.

I'm using an Oracle 8 database and I do have the Hibernate dialect appropriately set to net.sf.hibernate.dialect.OracleDialect. I can post more details if necessary but I figured that since I'm new at this, someone might have some answers readily at hand. Thanks.

Frank


Top
 Profile  
 
 Post subject: Joins
PostPosted: Sun Jan 09, 2005 11:08 pm 
Newbie

Joined: Thu Jan 06, 2005 4:25 pm
Posts: 12
Location: Redwood City, CA
I answered at least one of my questions.

I added "outer-join=true" to my mapping file and now I have joins where I expected them.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 09, 2005 11:12 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
3 = use dynamic-update=true


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 09, 2005 11:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
1 = wait for HB3 final


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.