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: specifying unique but NOT case-sensitive string field
PostPosted: Fri Dec 08, 2006 12:53 am 
Newbie

Joined: Mon Aug 07, 2006 2:44 am
Posts: 8
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.2ga

Name and version of the database you are using: mysql 5

how can i specify unique but not case-sensitive string field with annotations?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 4:40 pm 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
I don't think it's possible with Hibernate. Have a look here : http://www.hibernate.org/hib_docs/v3/re ... n-property

It's not the doc of hib annotations, but annotations normally permits what xml does too.

IMO, what you want to do is not really a unique key constraint, it's more like a "check" constraint : something that you can execute on each insert to check if it's correct.

I don't think dbms provide the ability to specify such a constraint calling it a "unique" one.

So, maybe you could have a look at the column mapping : http://www.hibernate.org/hib_docs/v3/re ... ing-column

Something like
Code:
<column
        name="your_col"
        not-null="true"
        check="here put your sql verifying that the value of the column is not already used, case insensitive"
/>

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


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.