-->
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: Autogenerated indexes on a many-to-many mapping table
PostPosted: Thu Sep 09, 2010 8:40 am 
Newbie

Joined: Mon Aug 16, 2010 12:32 pm
Posts: 12
Hi,

I have a many-to-many relation between a Hit and an Item like

Code:
class Hit {
..
    @IndexedEmbedded(depth = 1)
    //@ManyToMany(fetch = FetchType.LAZY)
    @ManyToMany(fetch = FetchType.EAGER)
    @Sort(type = SortType.COMPARATOR, comparator = BranchComparator.class)
    //@Analyzer(definition="StandardanalyzerSearch")
    private SortedSet<Item> items;
..
}


Code:
The Item does not have a reference to Hit, so u can do hit.getItems() but not item.getHits()


The Hit has a compound(bigint, varchar) key and the item a simple key(int), so the table consists of 3 columns with those keys

Code:
CREATE TABLE `hits_items` (
  `hits_id` bigint(20) NOT NULL,
  `hits_source` varchar(255) COLLATE utf8_bin NOT NULL,
  `items_id` bigint(20) NOT NULL,
  PRIMARY KEY (`hits_id`,`hits_source`,`items_id`)
) ENGINE=MyISAM



There are about 22 mil of them with a size of about .5G

The problem is that Hibernate is generating all possible intexes for this mapping table

ie

Primary: hit_id, hit_source, item_id
(2nd index):hit_id, hit_source
(3rd index):item_id

I dont need and dont want the 2 and 3rd indexes but hibernate always makes them automatically, how can I stop this from happening ?

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.