-->
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.  [ 5 posts ] 
Author Message
 Post subject: Creating an Index for many-to-one relationships
PostPosted: Fri Dec 02, 2005 9:51 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
Since 1-M lazy loading usually results in NHibernate issuing SQL queries with the foreign key to the 1 side of the relationship, is it a good practice to add a query to this column

e.g.

<many-to-one name="Order"
class="Emsi.Order.Data.DomainModel.Order, Emsi.Order.Data">
<column name="OrderId" index="OrderIndex" not-null="true"/>
</many-to-one>


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 10:54 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Do you mean adding an index? It depends on the database, some add an index when you define a foreign key, some don't.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 2:42 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
MS Sql Server, which I believe doesn't add it by default.

craig


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 5:01 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Then it will usually help, but this is really a question outside NHibernate scope.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 5:19 pm 
Regular
Regular

Joined: Tue May 31, 2005 9:55 am
Posts: 67
I agree. That is not an NHibernate concern.


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