[hibernate-issues] [Hibernate-JIRA] Created: (ANN-780) length attribute missing on @Index annotation

Xavier Sautejeau (JIRA) noreply at atlassian.com
Tue Oct 14 04:09:05 EDT 2008


length attribute missing on @Index annotation
---------------------------------------------

                 Key: ANN-780
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-780
             Project: Hibernate Annotations
          Issue Type: Improvement
    Affects Versions: 3.4.0.GA
            Reporter: Xavier Sautejeau


Using MySQL, one can do something like :

CREATE TABLE test(name TEXT, INDEX(name(255))

which creates a test table with an Index of length 255 on name.

Using Oracle one can use function based index to achieve similar result (create an index based on part of a column)

I am not 100% sure of the syntax, but it should look like

CREATE INDEX name_index ON test(SUBSTR(name,255))

However using Hibernate annotations, if one can specify that a column is to be used as an index, it seems like there is no way to specify the length of the index.

Therefore, (at least with MySQL) the column length is used for the index length.

But with some RDBMS, the index length can only go so far (for example 256 on MySQL), forcing you not to use the given column as an index since you cannot use Hibernate to tell it not to use the full length of the column for indexing.

The length attribute should be added to the @Index annotation and the appropriate index should be created for the various combinations of drivers/dialects supporting this feature


-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list