-->
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.  [ 2 posts ] 
Author Message
 Post subject: need to store a 128bits hash value as primary key
PostPosted: Wed Mar 01, 2006 5:40 am 
Newbie

Joined: Thu Feb 02, 2006 9:39 am
Posts: 19
Hi there,

I request your help for what seems to be a quite simple problem:

I need to store a 128 bits hash value (16 Bytes) as a primary key into my database via Hibernate. How could I do that ?

I first thought I use the hibernate "binary" type, but since it's mapped to a "tinyblob", I get (under MySQL 4.1) the following error :

Code:
Unsuccessful: create table feature (idFeature tinyblob not null, featureName varchar(255) not null, primary key (idFeature)) type=InnoDB
BLOB/TEXT column 'idFeature' used in key specification without a key length


Is it a way to make hibernate create for me a "binary(16)" instead of an "tinyblob", so I could use it as my primary key ?

I tried without success to specified the length of the BLOB:

Code:
<id name="id" type="binary" length="16" column="idFeature">


(by the way, I use an Hibernate v3.0)

Thanks in advance for your help,


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 01, 2006 11:32 am 
Newbie

Joined: Thu Feb 02, 2006 9:39 am
Posts: 19
So far I could only see 2 solutions:

- use a 16 length string: but since the underlying DB is in UTF-8 (for some other reason), it means my key will be 32 bytes long, which is twice larger than what I need.

- use a composite-id of 2 long to map my 16 bytes key.

Both solutions seems suboptimal too me, and performance is quite an issue in my case.

Any other ideas to map a 16 bytes values as an id ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.