-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate. specify a index key length
PostPosted: Thu Jun 12, 2008 1:01 pm 
Newbie

Joined: Sun May 25, 2008 9:02 am
Posts: 6
Hello,

I have this property in my hibernate .hbm.xml file, and it works ok:
<property name="name" type="string" index="name"/>

However, this one fails (when using Mysql):
<property name="name" type="text" index="name"/>

with:
16:03:00,013 ERROR SchemaExport:274 - Unsuccessful: create index sourceId on Item (sourceId)
16:03:00,013 ERROR SchemaExport:275 - BLOB/TEXT column 'sourceId' used in key specification without a key length

That is, with MySql you need to specify a length for a text column.

How can I specify a key length in the Hibernate file?

I've tried:
<property name="name" type="text" index="name(255)"/>
<property name="name" type="text" index="name" length="255"/>
but that's not valid syntax.


How can I specify a key length in the Hibernate file?


Many thanks,
DAvid


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.