-->
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: Hibernate usage of resultSet
PostPosted: Mon Mar 27, 2006 3:53 pm 
Newbie

Joined: Mon Mar 27, 2006 2:49 pm
Posts: 1
I have a small test app that persists a few hundred instances of a simple class and then performs a simple query to load them back. I have another test app that uses straight JDBC and does the same thing (ie. stores a few hundred records and then loads them back and goes through the result set and marshalls the data into class instances.)

I noticed a significant performance difference between the two apps. After some investigation, it appears to be with the way the resultSet is used. When calling resultSet.getXXX() you can either pass a string with the column name or the index. When I use an index in the JDBC test, it executes much faster than when using a string. The Javadocs for ResultSet suggest that this will be the case, due to translation and lookup that typically needs to be performed on the column name.

When I use the string parameter, my JDBC code perfomance is almost identical to that of the Hibernate code. I did a quick search of the Hibernate code and it does appear that the string version is being used.

I realize that this may be heavily driver dependent. I am using Hibernate 3.0.5 and hsqldb (latest version). Can you confirm that this is how Hibernate uses the resultSet? If so, would it be faster to maintain this mapping in the Hibernate software rather than having the driver do it? Any possibility that this could be changed? Is there any other way to avoid this hit (short of using a different driver)?

I have read a lot of threads in this forum about performance and realize it is a touchy subject. I know my example is a trivial mirco-benchmark and means nothing when compared to a real system. However, it seems that the suggested change would benefit any system.


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.