-->
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: Named unique constraint in Oracle
PostPosted: Wed Apr 13, 2011 11:39 am 
Beginner
Beginner

Joined: Wed Sep 03, 2003 9:31 am
Posts: 26
Hi. I'm using Oracle10g dialect and I need to create named unique constraints but it doesn't work.

I'm annotating my pojos this way:

Code:
@UniqueConstraint(name="uc_name", columnNames={"column"})


and getting the following ddl:

Code:
create table mytable (column varchar(10 char) unique);


What I really want is:

Code:
create table mytable (column varchar(10 char));
alter table mytable add constraint uc_name unique(column);


I could create unique indexes too, but the @Index annotation doesn't have any properties to indicate it's unique, so I have to stick to the @UniqueConstraint.

Although @UniqueConstraint has a "name" property, it's ignored when generating ddl. So what's the point of this property? I tried several other dialects and none of them uses the "name" property.

Am I missing something or hibernate really doesn't do that?


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.