-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to make TEXT as UNIQUE
PostPosted: Fri Oct 06, 2006 5:11 pm 
Newbie

Joined: Fri Oct 06, 2006 5:02 pm
Posts: 11
Hello everyone, this seems to me a very simple function, one I hasn't been able to figure it out how to achieve.

MySql requires an index prefix length to be defined. How do I "hibernatedo" that?


thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 07, 2006 12:48 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Icetbr,

One option is to add an extra text_hash column and store in the new field an md5sum() of the text column. You can index on this column and have hibernate/mysql efficiently check if the key exists. Then you can compare the text field. If you feel lucky, add an UNIQUE index ... hehe :)

Marius


Top
 Profile  
 
 Post subject: How to do this?
PostPosted: Mon Oct 09, 2006 8:03 am 
Newbie

Joined: Fri Oct 06, 2006 5:02 pm
Posts: 11
Ok, I have no idea how to do that. Could you show me the hbm code? If possible, the xDoclet as well.

It does sound too much trouble to obtain such a simple feature that is "unique", but I welcome the help all the same :-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 10, 2006 5:17 pm 
Regular
Regular

Joined: Tue Sep 26, 2006 11:37 am
Posts: 115
Location: Sacramento, CA
Icetbr,

No problem, but it will be easier if you start a working sample and then I will spend some time on it to implement my suggestion.



Marius


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