-->
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.  [ 4 posts ] 
Author Message
 Post subject: Can I prevent SchemaUpdate from adding indexes?
PostPosted: Tue Feb 24, 2004 12:13 am 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
I use net.sf.hibernate.tool.hbm2ddl.SchemaUpdate to update the schema for my MySQL database, but everytime I run it its add indexes even though the index has already been added, is there a way to turn this off somehow (short of hacking source)

for example I just added 2 mappings definition and definitionGroup, when I ran SchemaUpdate it added the 2 tables but also altered the existing mapping tables, heres how I did the SchemaUpdate and the output:

Configuration configuration = new Configuration().configure();
SessionFactory sessionFactory = configuration.buildSessionFactory();
new SchemaUpdate(configuration).execute(true);

----

[WARN] SessionFactoryObjectFactory - InitialContext did not implement EventContext
create table definition (id BIGINT not null, name VARCHAR(255), body text, definitionGroupId BIGINT, primary key (id))
create table definitionGroup (id BIGINT not null, name VARCHAR(255), primary key (id))
alter table definition add index (definitionGroupId), add constraint FKC3893553A158AB27 foreign key (definitionGroupId) references definitionGroup (id)
alter table answer add index (questionId), add constraint FKABCA3FBE22E2E3A1 foreign key (questionId) references question (id)
alter table exam add index (studyGuideId), add constraint FK2FB81FFA09B2E foreign key (studyGuideId) references studyGuide (id)
alter table question add index (correctAnswerId), add constraint FKBA823BE69E305403 foreign key (correctAnswerId) references answer (id)
alter table question add index (examId), add constraint FKBA823BE6B322359A foreign key (examId) references exam (id)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2004 7:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is a bug, sort of. Take a look here http://forum.hibernate.org/viewtopic.php?t=928084&highlight=mysql+index for a solution. There is also a JIRA entry here http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-720


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2004 4:09 pm 
Regular
Regular

Joined: Tue Aug 26, 2003 6:59 pm
Posts: 89
Location: Somewhere in the Ghetto
I was running into mysql's index limit too as mentioned in that post, now I guess its just a matter of waiting until this is patched for the next release? or just patch it myself in the meantime.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 02, 2004 11:53 am 
Regular
Regular

Joined: Wed Dec 17, 2003 1:58 pm
Posts: 102
Michael is there some reason this patch hasn't been implemented in the latest builds of Hibernate? It's been sitting there for months now and it works great...


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