[Hibernate-JIRA] Updated: (HB-1458) SchemaUpdate does not create column indexes (MySql)
by rayray (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HB-1458?page=all ]
rayray updated HB-1458:
-----------------------
Attachment: hibernate3.jar
> SchemaUpdate does not create column indexes (MySql)
> ---------------------------------------------------
>
> Key: HB-1458
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-1458
> Project: Hibernate2
> Type: Improvement
> Components: toolset
> Versions: 2.1.8
> Environment: Hibernate version: 2.1.8, MySQL version: 4.0.20, MySQL driver: mysql-connector-java-3.0.10-stable (also verified with 3.0.16 and 3.1.7)
> Reporter: Keith Wall
> Priority: Minor
> Attachments: CSDiff.txt, hibernate3.jar
>
>
> From forum thread: http://forum.hibernate.org/viewtopic.php?t=939655
> SchemaUpdate is failing to create indices specified using the <column> element in the mapping file. There is no error message generated. If I repeat the same test with the SchemaExport utility, the indices are created successfully.
> I include:
> 1) A mapping file that demonstrates the problem. This is a modified version of Simple.hbm.xml included in the Hibernate 2.1.8 distribution.
> 2) SQL sent to the server by SchemaUpdate (starting with a clean DB).
> 3) For comparison, the SQL sent to the server by SchemaExport (starting with a clean DB).
> Mapping file:
> <hibernate-mapping>
> <class name="org.hibernate.test.Simple">
> <id type="long" column="id_">
> <generator class="assigned"/>
> </id>
> <!-- BEGIN MODIFICATION -->
> <property name="name">
> <column name="name"
> index="test_idx" />
> </property>
> <!-- END MODIFICATION -->
> <property name="address"/>
> <property name="count" column="count_" not-null="true" unique="true"/>
> <property name="date" column="date_"/>
> <property name="pay"/>
> <many-to-one name="other" access="field"/>
> </class>
> </hibernate-mapping>
> Result:
> The table is created successfully, the primary key is created successfully, but no index on the column 'name' is created.
> SQL sent to server by SchemaUpdate:
> 050309 15:42:57 69 Init DB test
> 69 Query select round('inf'), round('-inf'), round('nan')
> 69 Query SHOW VARIABLES
> 69 Query SET autocommit=1
> 69 Query SET autocommit=0
> 69 Query commit
> 69 Query SET autocommit=1
> 69 Query SHOW TABLES FROM `test` LIKE 'Simple'
> 69 Query SHOW TABLES FROM `test` LIKE 'Simple'
> 69 Query create table Simple (id_ bigint not null, name varchar(255), address varchar(255), count_ integer not null unique, date_ datetime, pay float, other bigint, primary key (id_))
> 69 Query alter table Simple add index FK939D1DD26527F10 (other), add constraint FK939D1DD26527F10 foreign key (other) references Simple (id_)
> 69 Query SET autocommit=0
> 69 Query rollback
> 69 Quit
> SQL sent to server by SchemaExport:
> 050309 15:48:22 70 Connect root@localhost on test
> 70 Init DB test
> 70 Query select round('inf'), round('-inf'), round('nan')
> 70 Query SHOW VARIABLES
> 70 Query SET autocommit=1
> 70 Query SET autocommit=0
> 70 Query commit
> 70 Query SET autocommit=1
> 70 Query alter table Simple drop foreign key FK939D1DD26527F10
> 70 Query drop table if exists Simple
> 70 Query create table Simple (id_ bigint not null, name varchar(255), address varchar(255), count_ integer not null unique, date_ datetime, pay float, other bigint, primary key (id_))
> 70 Query create index test_idx on Simple (name)
> 70 Query alter table Simple add index FK939D1DD26527F10 (other), add constraint FK939D1DD26527F10 foreign key (other) references Simple (id_)
> 70 Quit
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
17 years, 10 months