-->
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: index automatically generatedy Hibernate?
PostPosted: Mon Mar 20, 2006 2:10 am 
Senior
Senior

Joined: Tue Sep 13, 2005 2:01 am
Posts: 137
I am using Jboss 4.0.3SP1.

I have a Employee table.(id, name, addrId).

Employee {
...
@OneToOne
@JoinColumn(name="addrId")
Address getAddress() {...}

String getName() {...}
}

I did not use @index on any properties.

After deploy,

mysql > show index from employee;

+------------+------------+---------------------------+--------------+---
| Table Non_unique | Key_name | Column_name
+------------+------------+---------------------------+--------------+---
| employee| 0 | PRIMARY | id
| employee| 0 | name | name
| employee| 0 | addrId | addrId
| employee| 1 | FKE5C254025FFF52BB | addrId

It seems that Hibernate has created 4 indexes.
Why create two indexes for addrId?
Is it useful to create index for addrId?


If I add index on name,

@Index(name="employee_name_idx")
String getName() {...}

The index on name will be created, ignoring existing index (on name).
I am confused. Please help me understand. It would be very nice. Thanks!


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.