Hibernate Core version: 3.3.0.SP1
Hibernate annotations version: 3.4.0.GA
Hibernate Tool version: 3.2.2
Name and version of the database you are using: MySQL 5.1.26-rc
I use hibernate tool (hbm2ddl) with Ant to export the schema into DB, in the DDL-file, i got code like this:
Code:
...
...
create table ColumnLayout (_id varchar(36) not null unique, _version integer, _active bit not null, _enabled bit not null, _identifier varchar(255), _name varchar(255), _order integer not null, _visible bit not null, _width integer not null, tablelayout_id varchar(36), sort_idx integer, primary key (_id)) ENGINE=InnoDB;
...
...
alter table ColumnLayout add index fk_tblLayout2colLayout (tablelayout_id), add constraint fk_tblLayout2colLayout foreign key (tablelayout_id) references TableLayout (_id);
and this code is slowly as the code, what mysqldump exported like this:
Code:
CREATE TABLE `columnlayout` (
`_id` varchar(36) COLLATE utf8_bin NOT NULL,
`_version` int(11) DEFAULT NULL,
`_active` bit(1) NOT NULL,
`_enabled` bit(1) NOT NULL,
`_identifier` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`_name` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`_order` int(11) NOT NULL,
`_visible` bit(1) NOT NULL,
`_width` int(11) NOT NULL,
`tablelayout_id` varchar(36) COLLATE utf8_bin DEFAULT NULL,
`sort_idx` int(11) DEFAULT NULL,
PRIMARY KEY (`_id`),
UNIQUE KEY `_id` (`_id`),
KEY `fk_tblLayout2colLayout` (`tablelayout_id`),
CONSTRAINT `fk_tblLayout2colLayout` FOREIGN KEY (`tablelayout_id`) REFERENCES `tablelayout` (`_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
Through test i am sure, that "alter table" is to slowly. And i have 300 tables, but i don't have this Problem with PostgreSQL.