-->
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: Foreign key & Indexes
PostPosted: Thu Jun 08, 2006 8:20 am 
Beginner
Beginner

Joined: Fri Oct 07, 2005 5:35 am
Posts: 38
Location: France
Mapping uses foreign keys to manage relationship such as oneToOne, MantyToOne, ... By default this keys are not indexed. It may result in some performance issues.

Is it possible to automatically create those indexes ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 12, 2006 8:05 am 
Regular
Regular

Joined: Wed Jan 11, 2006 12:49 pm
Posts: 64
Location: Campinas, Brazil
As far as I know, RDBMS need an index to manage a FK. MySQL manual recommends users to create te index themselves, but if they don't it is created automatically. I believe this is valid for all DBs. If you're letting Hibernate create your tables, you could add the annotation @org.hibernate.annotations.Index. This is not in the standard EJB 3 API, I believe, because indexes are an exclusivity of relational databases; but you could have an object-oriented database or serialization (like with Prevayler) as the persistence engine. I think it wouldn't hurt to add an 'indexed' or 'indexName' attribute to @Column anyway, would it?

_________________
Henrique Sousa
Don't forget to rate useful responses


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 14, 2006 3:51 am 
Beginner
Beginner

Joined: Fri Oct 07, 2005 5:35 am
Posts: 38
Location: France
If we need to add these indexes manually the risk is to forgot some of them. We previously used a JDO implmentation that add automatically these indexes. It was a nice feature.
In ODBMS there is index too.


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.