-->
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: SchemaUpdate-add index to existing table-MySQL?
PostPosted: Thu Mar 04, 2004 3:31 pm 
Newbie

Joined: Thu Mar 04, 2004 3:13 pm
Posts: 2
I am devoloping an application to analyze an arbitrary data set (output from a simulation) provided to our organization in the form of fully populated MySQL (MyISAM) tables (the simulation is run by another organization, so we have no say in the schema). The data base that we were provided is comprised of many interrelated tables, with absolutely no constraints, indices, etc defined. Several of the tables are quite large (2000000+ rows), and as such we need to define an index into those tables. Each simulation run will provide a whole new set of database tables, so we would like to automate the index creation process, without requiring the user to run any external tools first.

The problem is that the SchemaUpdate tool does not seem to generate the DDL to add an index to a pre-existing table, it only adds the index if the table does not exist when SchemaUpdate is run.

My Environment:
Hibernate 2.1.2
MySQL 4.1.0a
MySQL Connector/J 3.0.10

The relavant portion of the mapping file:
...
<property
name="simTime"
type="java.lang.Long"
update="true"
insert="true"
>
<column
name="simulationtime"
index="idx_asm_simulationtime"
not-null="true"
/>
</property>
...

SchemaExport generates the following DDL for this mapping:

drop table if exists aircraftstatemessage
create table aircraftstatemessage (
flightid INTEGER not null,
sequenceid BIGINT not null,
latitude DOUBLE PRECISION,
longitude DOUBLE PRECISION,
altitude DOUBLE PRECISION,
heading DOUBLE PRECISION,
simulationtime BIGINT not null,
groundspeed DOUBLE PRECISION,
primary key (flightid, sequenceid)
)
create index idx_asm_simulationtime on aircraftstatemessage (simulationtime)

However, SchemaUpdate generates nothing.

Any Ideas?

-Dan


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.