-->
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: Prevent Hibernate from creating Indexes?
PostPosted: Tue Nov 11, 2008 12:56 pm 
Newbie

Joined: Tue Nov 11, 2008 12:32 pm
Posts: 1
How can I *prevent* Hibernate from creating Indexes in the database?

CASE 1:
I have tables A and B, with primary keys a_id and b_id. A many-to-many relation table A_B links these two. The many-to-many relation table contains tuples (a_id, b_id). Hibernate generates three indexes: INDEX (a_id), INDEX (b_id), PRIMARY KEY (a_id, b_id). Can I disable the creation of the PRIMARY KEY, since it should never be needed?
The reason why I want to do this: The PRIMARY KEY is by far the largest index, because obviously the key space is very large. This leads to the situation that we have a table with 1.2 GB of data and 3.8 GB of indexes, so I want to get rid of the huge PRIMARY KEY index.

CASE 2:
We use JAVA inheritance. This leads to tables where the PRIMARY KEY is a FOREIGN KEY at the same time. In these situations, Hibernate generates both a PRIMARY KEY and an INDEX for the same field, which is redundant. For the same reasons as in CASE 1 I want to get rid of the redundant indexes.

Bottom line: In some cases I need to get rid of PRIMARY KEYS, in some cases foreign key indexes.

Unfortunately there seems to be no documentation at all on how to *not* index tables...

Of course I can just modify the schema by hand after exporting, but this is not a good solution.

Thanks!

Hibernate version:
3.3.1

Name and version of the database you are using:
MySQL 5.0 with MyISAM tables


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.