-->
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: MySQL and tinyblob primary keys
PostPosted: Mon Feb 11, 2008 1:26 pm 
Newbie

Joined: Mon Feb 11, 2008 1:16 pm
Posts: 2
Hi,

I've created a user type for Types.VARBINARY. I'm mapping to MySQL5 using annotations:

Code:
@Id
@Column(name = "ID", length = 16)
@GeneratedValue(generator = "uuid")
@Type(type = "sample.UUIDType")
@GenericGenerator(name = "uuid", strategy = "sample.UUIDGenerator")
private UUID uuid;


In persistence.xml:

Code:
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>


It works fine with HSQLDB but in MySQL it maps it to a tinyblob instead of a byte[] or raw. Here's the trace:

Code:
create table BOOKS (ID tinyblob not null, primary key (ID))


And MySQL complains:

Code:
BLOB/TEXT column 'ID' used in key specification without a key length


Even though it has been defined with length 16. Can I make this work (using just annotations preferably)?

Regards,


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.