-->
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.  [ 3 posts ] 
Author Message
 Post subject: Creating database indexes
PostPosted: Fri Apr 22, 2005 1:43 pm 
Beginner
Beginner

Joined: Sun Feb 20, 2005 12:14 am
Posts: 49
I am trying to create database indexes in a table. (The indexes that I am trying to create are not being created).

Hibernate version: 3.0
Name and version of the database you are using: MySQL version 4.1.10
Mapping documents:
Code:
   <!-- DESCRIPTION -->
   <class name="Description" table="description">
      <id name="id" unsaved-value="null" type="string" length="32">
           <generator class="uuid"/>
      </id>

      <version name="version" type="long" unsaved-value="null"/>
       
      <property name="type" type="string" not-null="true" index="type_index"/>
      <property name="text" type="string" length="65536"/>
       
      <any name="entity" id-type="string" meta-type="string">
           <meta-value class="Product" value="PRODUCT"/>
           <column name="entityType" not-null="true" index="entityType_index"/>
           <column name="entityId" not-null="true" index="entityId_index"/>
      </any>
   </class>

When I go to the mysql prompt and execute this:
Code:
show index from description;


I get the following:
Code:
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table       | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| description |          0 | PRIMARY  |            1 | id          | A         |           0 |     NULL | NULL   |      | BTREE      |         |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+


The indexes I am trying to create by specifying the index attribute on the property and the two column elements is not being created? Am I missing something here?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 26, 2005 3:15 am 
Newbie

Joined: Fri Feb 20, 2004 6:26 am
Posts: 12
I figured that, at least in Hibernate2, you have to specify the 'column' tag to create indexes.

In your case, this would be

<property name="type" type="string" not-null="true" column="type" index="type_index"/>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 26, 2005 3:07 pm 
Beginner
Beginner

Joined: Sun Feb 20, 2005 12:14 am
Posts: 49
I tried doing that, but no change.


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