-->
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: MySQL: BLOB column used without a key length
PostPosted: Mon Jun 21, 2004 5:53 am 
Newbie

Joined: Fri Jun 11, 2004 8:41 am
Posts: 6
Location: Belgium
Hi,

I'm trying this mapping in MySQL which gives an error message when I run SchemaExportTask:

<property
name="url"
type="string"
update="true"
insert="true"
access="property"
column="URL"
length="1024"
not-null="true"
unique="true"
/>

[schemaexport] (hbm2ddl.SchemaExport 154 ) Unsuccessful:
create table LINK_STATS (
ID INTEGER NOT NULL AUTO_INCREMENT,
URL TEXT not null unique,
NB_VISITS INTEGER not null,
primary key (ID))
[schemaexport] (hbm2ddl.SchemaExport 155 ) General error, message from server: "BLOB column 'URL' used in key specification without a key length"


When I set the length of the column to 255, I don't get an error (since MySQL uses the varchar type for this).

Also, when I allow nulls and duplicate values, it works too, but then I don't have an index on the column.

I tried @hibernate.column to add an index, but have the same problem here.

According to http://dev.mysql.com/doc/mysql/en/CREATE_TABLE.html, I need to indicate an index prefix by using something like

CREATE TABLE test (url BLOB, INDEX(url(10)));


Is there any way I can indicate this in my Hibernate mappings (preferably XDoclet)?

Thanks,

Pieter Coucke

Hibernate 2.1.4
Mysql 4.0.18-nt


Top
 Profile  
 
 Post subject: Wrong forum
PostPosted: Mon Jun 21, 2004 5:56 am 
Newbie

Joined: Fri Jun 11, 2004 8:41 am
Posts: 6
Location: Belgium
Sorry, wrong forum. Please remove this message.


Top
 Profile  
 
 Post subject: Moved
PostPosted: Mon Jun 21, 2004 6:01 am 
Newbie

Joined: Fri Jun 11, 2004 8:41 am
Posts: 6
Location: Belgium
Moved to http://forum.hibernate.org/viewtopic.php?p=2206252#2206252


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.