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)
|