Using MySQL, one can do something like :
Code:
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
Code:
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.
Seems like this feature is missing and AFAIK it has not been reported in JIRA.
Shall I open an issue ?