-->
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.  [ 3 posts ] 
Author Message
 Post subject: optimization question regarding collections
PostPosted: Fri Jul 18, 2008 12:20 pm 
Newbie

Joined: Thu Jul 28, 2005 6:17 am
Posts: 14
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:3.5.2

DB2: 8.2

Hi,

I have a question about what would be a better implementation, if any, of the one i've got now.

I have a class A which holds a collection (Set) of type class B.

My implementation is similair to:
http://forum.hibernate.org/posting.php? ... wtopic&f=1

<set name="orderLines" inverse="true">
<key>
<column name="orderId"/>
<column name="customerId"/>
</key>
<one-to-many class="OrderLine"/>
</set>
also with composite keys and an order-by clause.

What i see is that for there are 2 seperate queries being executed (both Selects) and i was wondering if there is a way make hibernate create 1 query. I need to do some research regarding the responsetimes but i want to do them on both options.

I hope someone has some suggestions or examples.

Thanks,
Maarten


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 19, 2008 10:05 am 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
You'll find that you'll get two queries. This is natural, and shouldn't have any major impact on performance. Both queries run over the same connection and are part of the same transaction. If it created separate connections, or used multiple transactions, then you might worry, but none of that is true.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 19, 2008 4:48 pm 
Newbie

Joined: Thu Jul 28, 2005 6:17 am
Posts: 14
Thanks for the reply. I tought there might be some join statement possible which only requires 1 statement being executed, but offcourse i don't know if that statement takes longer than the 2 simpeler ones:-)

Thanks,
Maarten


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